correzione numseen, numfav, ...: ora li ho aggiunti alle tabelle...

This commit is contained in:
Surya Paolo
2023-10-03 00:40:54 +02:00
parent 31598e3fbd
commit c02037b35c
5 changed files with 53 additions and 42 deletions

View File

@@ -1706,10 +1706,8 @@ export const useUserStore = defineStore('UserStore', {
.then((res) => {
if (res && res.data.state === 1) {
if (myrec) {
if (!myrec.myreact) {
myrec.myreact = {
numfav: 0,
}
if (!myrec.numfav) {
myrec.numfav = 0
}
if (!recreaction)
@@ -1717,13 +1715,13 @@ export const useUserStore = defineStore('UserStore', {
else
recreaction.fav = true;
myrec.myreact.numfav++
myrec.numfav++
}
tools.showPositiveNotif($q, t('cmd.favorite_set'))
} else if (res && res.data.state === -1) {
// this.my.profile.favorite = tools.removeIObjectOnce(this.my.profile.favorite, { id, tab })
if (myrec && myrec.myreact.numfav) {
myrec.myreact.numfav--
if (myrec && myrec.numfav) {
myrec.numfav--
//this.my.profile.reaction = this.my.profile.reaction.filter((rec: IReaction) => !((rec.idrec === id) && (rec.tab === tab) && (rec.username === this.my.username) && (rec.fav === true)))
if (recreaction)
recreaction.fav = false
@@ -1749,10 +1747,8 @@ export const useUserStore = defineStore('UserStore', {
return await Api.SendReq('/reactions/cmd', 'POST', { cmd: CMD_REACTION.SET_ATTEND, id, tab, value })
.then((res) => {
if (res && res.data.state === 1) {
if (!myrec.myreact) {
myrec.myreact = {
numattend: 0,
}
if (!myrec.numattend) {
myrec.numattend = 0
}
if (!myrec.myreact.attend)
myrec.myreact.attend = false
@@ -1815,10 +1811,8 @@ export const useUserStore = defineStore('UserStore', {
return await Api.SendReq('/reactions/cmd', 'POST', { cmd: CMD_REACTION.SET_BOOKMARK, id, tab, value })
.then((res) => {
if (res && res.data.state === 1) {
if (!myrec.myreact) {
myrec.myreact = {
numseen: 0,
}
if (!myrec.numbook) {
myrec.numbook = 0
}
if (!myrec.mybook)
myrec.mybook = []
@@ -1827,13 +1821,13 @@ export const useUserStore = defineStore('UserStore', {
else
recreaction.book = true
myrec.myreact.numbook++
myrec.numbook++
tools.showPositiveNotif($q, t('cmd.bookmark_set'))
} else if (res && res.data.state === -1) {
//++ this.my.profile.reaction = tools.removeIObjectOnce(this.my.profile.reaction, { id, tab, })
if ((myrec && myrec.mybook) && recreaction)
recreaction.book = false
myrec.myreact.numbook--
myrec.numbook--
//myrec.mybook = myrec.mybook.filter((rec: IFavBook) => rec.username !== this.my.username)
tools.showNegativeNotif($q, t('cmd.bookmark_unset'))
}
@@ -1876,12 +1870,12 @@ export const useUserStore = defineStore('UserStore', {
.then((res) => {
if (res && res.data.state === 1) {
if (value) {
if (!myrec.myreact) {
myrec.myreact = {
if (!myrec) {
myrec = {
numseen: 0,
}
}
myrec.myreact.numseen++
myrec.numseen++
if (!recreaction)
this.my.profile.reaction.push({ id: objectId(), idrec: id, tab, username: this.my.username, seen: true })
else