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">
<UserSelector v-model="user" />
</div>
<div class="col-1 justify-end">
<q-btn round flat icon="mdi-format-list-checks" @click="openHistory" />
<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

@ -131,14 +131,14 @@ export const useBalanceStore = defineStore({
user: FG.User,
filter:
| {
limit?: number;
offset?: number;
from?: Date;
to?: Date;
showReversals?: boolean;
showCancelled?: boolean;
descending?: boolean;
}
limit?: number;
offset?: number;
from?: Date;
to?: Date;
showReversals?: boolean;
showCancelled?: boolean;
descending?: boolean;
}
| undefined = undefined
) {
if (!filter) filter = { limit: 10 };
@ -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;
},