Implemented rework suggestion by adding backer to group aggregation

This commit is contained in:
osiris
2020-01-08 17:17:48 +08:00
parent 2427743d0f
commit 98e0e96494
4 changed files with 13 additions and 7 deletions

View File

@@ -71,8 +71,8 @@
}
.tierNPC, .npc {
color: #4E4A57;
fill: #4E4A57;
color: #4e4a57;
fill: #4e4a57;
stroke: #005737;
&:hover, &:active, &:focus {

View File

@@ -38,7 +38,10 @@
<span>{{ $t('push') }}</span>
</th>
</tr>
<tr v-for="notification in notificationsIds" :key="notification">
<tr
v-for="notification in notificationsIds"
:key="notification"
>
<td>
<span>{{ $t(notification) }}</span>
</td>
@@ -55,7 +58,7 @@
type="checkbox"
@change="set('pushNotifications', notification)"
>
<td v-else>
</td><td v-else>
&nbsp;
</td>
</tr>

View File

@@ -33,7 +33,10 @@
<div class="how-many-to-buy">
<strong>{{ $t('howManyToBuy') }}</strong>
</div>
<div class="mb-3" v-if="item.addlNotes">
<div
v-if="item.addlNotes"
class="mb-3"
>
{{ item.addlNotes }}
</div>
<div class="box">

View File

@@ -94,6 +94,7 @@ async function usersMapByConversations (owner, users) {
_id: '$uuid',
userStyles: { $last: '$userStyles' },
contributor: { $last: '$contributor' },
backer: { $last: '$backer' },
},
},
]);
@@ -125,7 +126,6 @@ export async function listConversations (owner) {
username: { $last: '$username' },
timestamp: { $last: '$timestamp' },
text: { $last: '$text' },
npc: { $addToSet: '$backer.npc' },
count: { $sum: 1 },
},
},
@@ -142,7 +142,7 @@ export async function listConversations (owner) {
const conversations = conversationsList.map(res => ({
uuid: res._id,
...res,
backer: Array.isArray(res.npc) && res.npc.length > 0 ? { npc: res.npc[0] } : { npc: null },
backer: usersMap[res._id].backer,
userStyles: usersMap[res._id].userStyles,
contributor: usersMap[res._id].contributor,
}));