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

View File

@ -146,7 +146,13 @@ export const useBalanceStore = defineStore({
params: filter,
});
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;
},