From dc09a0ccf665106d3e6c08b135f52e56ff4768db Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Wed, 30 Mar 2022 15:03:54 +0200 Subject: [PATCH 1/5] get balance of previous transaction to avoid decay calculation --- .../DecayInformations/DecayInformation-Decay.vue | 6 +++++- frontend/src/components/GddTransactionList.vue | 10 +++++++++- .../src/components/Transactions/TransactionDecay.vue | 10 +++++++++- 3 files changed, 23 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/DecayInformations/DecayInformation-Decay.vue b/frontend/src/components/DecayInformations/DecayInformation-Decay.vue index 6abacd2b8..d8ba13738 100644 --- a/frontend/src/components/DecayInformations/DecayInformation-Decay.vue +++ b/frontend/src/components/DecayInformations/DecayInformation-Decay.vue @@ -13,7 +13,7 @@
- {{ (Number(balance) - Number(decay)) | GDD }} + {{ previousBookedBalance | GDD }} {{ decay | GDD }} {{ $t('math.equal') }} {{ balance | GDD }}
@@ -33,6 +33,10 @@ export default { type: String, required: true, }, + previousBookedBalance: { + type: String, + required: true, + }, }, } diff --git a/frontend/src/components/GddTransactionList.vue b/frontend/src/components/GddTransactionList.vue index 2424907c5..7be0797a8 100644 --- a/frontend/src/components/GddTransactionList.vue +++ b/frontend/src/components/GddTransactionList.vue @@ -15,7 +15,11 @@
@@ -36,6 +37,7 @@ class="list-group-item" v-bind="transactions[index]" :decayStartBlock="decayStartBlock" + :previousBookedBalance="previousBookedBalance(index)" v-on="$listeners" /> @@ -45,6 +47,7 @@ class="list-group-item" v-bind="transactions[index]" :decayStartBlock="decayStartBlock" + :previousBookedBalance="previousBookedBalance(index)" v-on="$listeners" /> @@ -116,7 +119,7 @@ export default { }, previousBookedBalance(idx) { if (this.transactions[idx + 1]) return this.transactions[idx + 1].balance - return 0 + return '0' }, }, watch: { diff --git a/frontend/src/components/Transactions/TransactionCreation.vue b/frontend/src/components/Transactions/TransactionCreation.vue index f343a92ac..dce11307b 100644 --- a/frontend/src/components/Transactions/TransactionCreation.vue +++ b/frontend/src/components/Transactions/TransactionCreation.vue @@ -47,7 +47,7 @@ import DecayRow from '../TransactionRows/DecayRow' import DecayInformation from '../DecayInformations/DecayInformation' export default { - name: 'slot-creation', + name: 'TransactionCreation', components: { CollapseIcon, TypeIcon, @@ -86,6 +86,10 @@ export default { type: Date, required: true, }, + previousBookedBalance: { + type: String, + required: true, + }, }, data() { return { diff --git a/frontend/src/components/Transactions/TransactionDecay.vue b/frontend/src/components/Transactions/TransactionDecay.vue index d61beb026..372705a4c 100644 --- a/frontend/src/components/Transactions/TransactionDecay.vue +++ b/frontend/src/components/Transactions/TransactionDecay.vue @@ -37,7 +37,7 @@ import AmountAndNameRow from '../TransactionRows/AmountAndNameRow' import DecayInformationDecay from '../DecayInformations/DecayInformation-Decay' export default { - name: 'slot-decay', + name: 'TransactionDecay', components: { CollapseIcon, TypeIcon, diff --git a/frontend/src/components/Transactions/TransactionReceive.vue b/frontend/src/components/Transactions/TransactionReceive.vue index f83c84e53..32e40f71e 100644 --- a/frontend/src/components/Transactions/TransactionReceive.vue +++ b/frontend/src/components/Transactions/TransactionReceive.vue @@ -53,7 +53,7 @@ import DecayRow from '../TransactionRows/DecayRow' import DecayInformation from '../DecayInformations/DecayInformation' export default { - name: 'slot-receive', + name: 'TransactionReceive', components: { CollapseIcon, TypeIcon, @@ -95,6 +95,10 @@ export default { type: Number, required: false, }, + previousBookedBalance: { + type: String, + required: true, + }, }, data() { return { diff --git a/frontend/src/components/Transactions/TransactionSend.vue b/frontend/src/components/Transactions/TransactionSend.vue index 2f9ef54d2..a1ea3c88e 100644 --- a/frontend/src/components/Transactions/TransactionSend.vue +++ b/frontend/src/components/Transactions/TransactionSend.vue @@ -53,7 +53,7 @@ import DecayRow from '../TransactionRows/DecayRow' import DecayInformation from '../DecayInformations/DecayInformation' export default { - name: 'slot-send', + name: 'TransactionSend', components: { CollapseIcon, TypeIcon, @@ -96,6 +96,10 @@ export default { type: Number, required: false, }, + previousBookedBalance: { + type: String, + required: true, + }, }, data() { return { From 19a26d5fb7d609f140bb3eeb8d346ef0cc9b8d54 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Wed, 30 Mar 2022 16:02:57 +0200 Subject: [PATCH 4/5] add required prop previous booked balance tp specs --- frontend/src/components/Transactions/TransactionCreation.spec.js | 1 + frontend/src/components/Transactions/TransactionDecay.spec.js | 1 + frontend/src/components/Transactions/TransactionReceive.spec.js | 1 + frontend/src/components/Transactions/TransactionSend.spec.js | 1 + 4 files changed, 4 insertions(+) diff --git a/frontend/src/components/Transactions/TransactionCreation.spec.js b/frontend/src/components/Transactions/TransactionCreation.spec.js index e1ea9e0b0..be0713ecf 100644 --- a/frontend/src/components/Transactions/TransactionCreation.spec.js +++ b/frontend/src/components/Transactions/TransactionCreation.spec.js @@ -31,6 +31,7 @@ const propsData = { memo: 'sadasd asdasdasdasdadadd da dad aad', typeId: 'DECAY', decayStartBlock: new Date('2021-05-13T17:46:31.000Z'), + previousBookedBalance: '43.56', } describe('TransactionCreation', () => { diff --git a/frontend/src/components/Transactions/TransactionDecay.spec.js b/frontend/src/components/Transactions/TransactionDecay.spec.js index 232e7f85a..8c5236b6e 100644 --- a/frontend/src/components/Transactions/TransactionDecay.spec.js +++ b/frontend/src/components/Transactions/TransactionDecay.spec.js @@ -31,6 +31,7 @@ const propsData = { memo: 'sadasd asdasdasdasdadadd da dad aad', typeId: 'DECAY', decayStartBlock: new Date('2021-05-13T17:46:31.000Z'), + previousBookedBalance: '43.56', } describe('TransactionDecay', () => { diff --git a/frontend/src/components/Transactions/TransactionReceive.spec.js b/frontend/src/components/Transactions/TransactionReceive.spec.js index f5b27cf47..46cb57e06 100644 --- a/frontend/src/components/Transactions/TransactionReceive.spec.js +++ b/frontend/src/components/Transactions/TransactionReceive.spec.js @@ -31,6 +31,7 @@ const propsData = { memo: 'sadasd asdasdasdasdadadd da dad aad', typeId: 'RECEIVE', decayStartBlock: new Date('2021-05-13T17:46:31.000Z'), + previousBookedBalance: '43.56', } describe('TransactionReceive', () => { diff --git a/frontend/src/components/Transactions/TransactionSend.spec.js b/frontend/src/components/Transactions/TransactionSend.spec.js index 632c0857a..410fcc733 100644 --- a/frontend/src/components/Transactions/TransactionSend.spec.js +++ b/frontend/src/components/Transactions/TransactionSend.spec.js @@ -31,6 +31,7 @@ const propsData = { memo: 'sadasd asdasdasdasdadadd da dad aad', typeId: 'SEND', decayStartBlock: new Date('2021-05-13T17:46:31.000Z'), + previousBookedBalance: '43.56', } describe('TransactionSend', () => { From fda507c54c19178e7aa5f500dbbd8f7572fff418 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Wed, 30 Mar 2022 16:08:36 +0200 Subject: [PATCH 5/5] add balance to transaction objects created for pagination tests --- frontend/src/components/GddTransactionList.spec.js | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/src/components/GddTransactionList.spec.js b/frontend/src/components/GddTransactionList.spec.js index ba45d93d4..aeecf43cc 100644 --- a/frontend/src/components/GddTransactionList.spec.js +++ b/frontend/src/components/GddTransactionList.spec.js @@ -419,6 +419,7 @@ describe('GddTransactionList', () => { }, id: idx + 1, typeId: 'RECEIVE', + balance: '33.33', } })