get balance of previous transaction to avoid decay calculation

This commit is contained in:
Moriz Wahl 2022-03-30 15:03:54 +02:00
parent 9ce0229345
commit dc09a0ccf6
3 changed files with 23 additions and 3 deletions

View File

@ -13,7 +13,7 @@
</b-col>
<b-col cols="6">
<div>
{{ (Number(balance) - Number(decay)) | GDD }}
{{ previousBookedBalance | GDD }}
{{ decay | GDD }} {{ $t('math.equal') }}
<b>{{ balance | GDD }}</b>
</div>
@ -33,6 +33,10 @@ export default {
type: String,
required: true,
},
previousBookedBalance: {
type: String,
required: true,
},
},
}
</script>

View File

@ -15,7 +15,11 @@
<div v-for="({ id, typeId }, index) in transactions" :key="id">
<transaction-list-item :typeId="typeId" class="pointer">
<template #DECAY>
<transaction-decay class="list-group-item" v-bind="transactions[index]" />
<transaction-decay
class="list-group-item"
v-bind="transactions[index]"
:previousBookedBalance="previousBookedBalance(index)"
/>
</template>
<template #SEND>
@ -110,6 +114,10 @@ export default {
})
window.scrollTo(0, 0)
},
previousBookedBalance(idx) {
if (this.transactions[idx + 1]) return this.transactions[idx + 1].balance
return 0
},
},
watch: {
currentPage() {

View File

@ -21,7 +21,11 @@
</div>
<b-collapse class="pb-4 pt-5" v-model="visible">
<decay-information-decay :balance="balance" :decay="decay.decay" />
<decay-information-decay
:balance="balance"
:decay="decay.decay"
:previousBookedBalance="previousBookedBalance"
/>
</b-collapse>
</div>
</div>
@ -53,6 +57,10 @@ export default {
type: Object,
required: true,
},
previousBookedBalance: {
type: String,
required: true,
},
},
data() {
return {