fix that transaction list on to revert does not have multiple items

This commit is contained in:
Tim Gröger 2023-05-17 14:22:46 +02:00
parent 56b09abeaa
commit ebffecd364
2 changed files with 19 additions and 11 deletions

View File

@ -10,8 +10,10 @@
<div v-if="showSelector" class="col-6"> <div v-if="showSelector" class="col-6">
<UserSelector v-model="user" /> <UserSelector v-model="user" />
</div> </div>
<div class="col-1 justify-end"> <div class="col-1">
<q-btn round flat icon="mdi-format-list-checks" @click="openHistory" /> <div class="row fit justify-end content-end items-end">
<q-btn round flat icon="mdi-format-list-checks" @click="openHistory" />
</div>
</div> </div>
</q-card-section> </q-card-section>
</template> </template>

View File

@ -131,14 +131,14 @@ export const useBalanceStore = defineStore({
user: FG.User, user: FG.User,
filter: filter:
| { | {
limit?: number; limit?: number;
offset?: number; offset?: number;
from?: Date; from?: Date;
to?: Date; to?: Date;
showReversals?: boolean; showReversals?: boolean;
showCancelled?: boolean; showCancelled?: boolean;
descending?: boolean; descending?: boolean;
} }
| undefined = undefined | undefined = undefined
) { ) {
if (!filter) filter = { limit: 10 }; if (!filter) filter = { limit: 10 };
@ -146,7 +146,13 @@ export const useBalanceStore = defineStore({
params: filter, params: filter,
}); });
data.transactions.forEach((t) => fixTransaction(t)); data.transactions.forEach((t) => fixTransaction(t));
if (data.transactions) this.transactions.push(...data.transactions); if (data.transactions) {
data.transactions.forEach((t) => {
const idx = this.transactions.findIndex((x) => x.id === t.id);
if (idx == -1) this.transactions.push(t);
else this.transactions[idx] = t;
});
}
return data; return data;
}, },