From 945e0a3fd9d3d5d4d69e36175466ddff404278d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Wed, 4 May 2022 10:09:26 +0200 Subject: [PATCH 1/7] Fix that pagination on gdd-transactions-list not hides if ther's only one page --- frontend/src/components/GddTransactionList.vue | 17 +++++++++++------ frontend/src/pages/Transactions.vue | 2 +- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/frontend/src/components/GddTransactionList.vue b/frontend/src/components/GddTransactionList.vue index 34f7c24ab..bbb822ad9 100644 --- a/frontend/src/components/GddTransactionList.vue +++ b/frontend/src/components/GddTransactionList.vue @@ -61,7 +61,7 @@ [] }, pageSize: { type: Number, default: 25 }, @@ -110,6 +105,11 @@ export default { showPagination: { type: Boolean, default: false }, pending: { type: Boolean }, }, + data() { + return { + currentPage: 1, + } + }, methods: { updateTransactions() { this.$emit('update-transactions', { @@ -123,6 +123,11 @@ export default { return '0' }, }, + computed: { + isPaginationVisible() { + return this.showPagination && this.pageSize < this.transactions.length + }, + }, watch: { currentPage() { this.updateTransactions() diff --git a/frontend/src/pages/Transactions.vue b/frontend/src/pages/Transactions.vue index 568f80df2..109e3f19c 100644 --- a/frontend/src/pages/Transactions.vue +++ b/frontend/src/pages/Transactions.vue @@ -9,7 +9,7 @@ :transactionCount="transactionCount" :transactionLinkCount="transactionLinkCount" :transactions="transactions" - :show-pagination="true" + :showPagination="true" @update-transactions="updateTransactions" v-on="$listeners" /> From 84a697a300e468ae6f75ca0d1f842b6c7a056373 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Thu, 5 May 2022 14:02:25 +0200 Subject: [PATCH 2/7] Set 28 positive transactions in seeding for bob@baumeister.de --- backend/src/seeds/creation/index.ts | 137 +++++++++++++++++- .../src/components/GddTransactionList.spec.js | 17 ++- .../src/components/GddTransactionList.vue | 6 +- 3 files changed, 146 insertions(+), 14 deletions(-) diff --git a/backend/src/seeds/creation/index.ts b/backend/src/seeds/creation/index.ts index 20d30d94c..000345e5b 100644 --- a/backend/src/seeds/creation/index.ts +++ b/backend/src/seeds/creation/index.ts @@ -1,6 +1,134 @@ import { CreationInterface } from './CreationInterface' import { nMonthsBefore } from '../factory/creation' +const bobsSendings = [ + { + amount: 10, + memo: 'Herzlich Willkommen bei Gradido!', + }, + { + amount: 10, + memo: 'von Betty', + }, + { + amount: 23.37, + memo: 'von David', + }, + { + amount: 47, + memo: 'von Frau Holle', + }, + { + amount: 1.02, + memo: 'von Herr Müller', + }, + { + amount: 5.67, + memo: 'von Maier', + }, + { + amount: 72.93, + memo: 'von Elsbeth', + }, + { + amount: 5.6, + memo: 'von Daniel', + }, + { + amount: 8.87, + memo: 'von Yoda', + }, + { + amount: 7.56, + memo: 'von Sabine', + }, + { + amount: 7.89, + memo: 'von Karl', + }, + { + amount: 8.9, + memo: 'von Darth Vader', + }, + { + amount: 56.79, + memo: 'von Luci', + }, + { + amount: 3.45, + memo: 'von Hanne', + }, + { + amount: 8.74, + memo: 'von Luise', + }, + { + amount: 7.85, + memo: 'von Annegred', + }, + { + amount: 32.7, + memo: 'von Prinz von Zamunda', + }, + { + amount: 44.2, + memo: 'von Charly Brown', + }, + { + amount: 38.17, + memo: 'von Michael', + }, + { + amount: 5.72, + memo: 'von Kaja', + }, + { + amount: 3.99, + memo: 'von Maja', + }, + { + amount: 4.5, + memo: 'von Martha', + }, + { + amount: 8.3, + memo: 'von Ursula', + }, + { + amount: 2.9, + memo: 'von Urs', + }, + { + amount: 4.6, + memo: 'von Mecedes', + }, + { + amount: 74.1, + memo: 'von Heidi', + }, + { + amount: 4.5, + memo: 'von Peter', + }, + { + amount: 5.8, + memo: 'von Frau Rottenmeier', + }, +] +let bobsSum = 0 +const bobsTransactions: CreationInterface[] = [] +bobsSendings.forEach((sending) => { + bobsSum = bobsSum + sending.amount + bobsTransactions.push({ + email: 'bob@baumeister.de', + amount: sending.amount, + memo: sending.memo, + creationDate: nMonthsBefore(new Date()), + confirmed: true, + }) +}) +console.log('bobsSum: ', bobsSum) + export const creations: CreationInterface[] = [ { email: 'bibi@bloxberg.de', @@ -10,14 +138,7 @@ export const creations: CreationInterface[] = [ confirmed: true, moveCreationDate: 12, }, - { - email: 'bob@baumeister.de', - amount: 1000, - memo: 'Herzlich Willkommen bei Gradido!', - creationDate: nMonthsBefore(new Date()), - confirmed: true, - moveCreationDate: 8, - }, + ...bobsTransactions, { email: 'raeuber@hotzenplotz.de', amount: 1000, diff --git a/frontend/src/components/GddTransactionList.spec.js b/frontend/src/components/GddTransactionList.spec.js index 37152c1c2..b792cc3cc 100644 --- a/frontend/src/components/GddTransactionList.spec.js +++ b/frontend/src/components/GddTransactionList.spec.js @@ -451,8 +451,18 @@ describe('GddTransactionList', () => { }) }) - describe('show no pagination', () => { - beforeEach(async () => { + describe.skip('show no pagination', () => { + // Wolle: beforeEach(async () => { + // await wrapper.setProps({ + // transactions: [], + // transactionCount: 2, + // decayStartBlock, + // pageSize: 25, + // showPagination: false, + // }) + // }) + + it('shows no pagination buttons', async () => { await wrapper.setProps({ transactions: [], transactionCount: 2, @@ -460,9 +470,6 @@ describe('GddTransactionList', () => { pageSize: 25, showPagination: false, }) - }) - - it('shows no pagination buttons', () => { expect(wrapper.find('ul.pagination').exists()).toBe(false) }) }) diff --git a/frontend/src/components/GddTransactionList.vue b/frontend/src/components/GddTransactionList.vue index bbb822ad9..abc9ecb0e 100644 --- a/frontend/src/components/GddTransactionList.vue +++ b/frontend/src/components/GddTransactionList.vue @@ -125,7 +125,11 @@ export default { }, computed: { isPaginationVisible() { - return this.showPagination && this.pageSize < this.transactions.length + // Wolle: console.log('this.showPagination: ', this.showPagination) + // console.log('this.pageSize: ', this.pageSize) + // console.log('this.transactions.length: ', this.transactions.length) + // console.log('this.transactionCount: ', this.transactionCount) + return this.showPagination && this.pageSize < this.transactionCount }, }, watch: { From 1a6ef9c5952c07e2caaaf60f804d0d6b06d6c2de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Thu, 5 May 2022 15:05:07 +0200 Subject: [PATCH 3/7] Comment out Bobs sum --- backend/src/seeds/creation/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/seeds/creation/index.ts b/backend/src/seeds/creation/index.ts index 000345e5b..598a76cd7 100644 --- a/backend/src/seeds/creation/index.ts +++ b/backend/src/seeds/creation/index.ts @@ -127,7 +127,7 @@ bobsSendings.forEach((sending) => { confirmed: true, }) }) -console.log('bobsSum: ', bobsSum) +// Wolle: console.log('bobsSum: ', bobsSum) export const creations: CreationInterface[] = [ { From c10115397568550cfaf69eb5317a97e2f8e0f049 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Thu, 5 May 2022 16:30:35 +0200 Subject: [PATCH 4/7] Fix quickly the account sum problem for the seeding of bob's transactions --- backend/src/seeds/index.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/backend/src/seeds/index.ts b/backend/src/seeds/index.ts index f26000e06..e6bca3078 100644 --- a/backend/src/seeds/index.ts +++ b/backend/src/seeds/index.ts @@ -66,7 +66,10 @@ const run = async () => { // create GDD for (let i = 0; i < creations.length; i++) { + const now = new Date().getTime() // we have to wait a little! quick fix for account sum problem of bob@baumeister.de await creationFactory(seedClient, creations[i]) + // eslint-disable-next-line no-empty + while (new Date().getTime() < now + 1000) {} // we have to wait a little! quick fix for account sum problem of bob@baumeister.de } // create Transaction Links From 6b9fbc920e8ba0774a64fd183bc1b97dae02cbbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wolfgang=20Hu=C3=9F?= Date: Mon, 16 May 2022 11:39:48 +0200 Subject: [PATCH 5/7] Add test for invisible pagination buttons --- backend/src/seeds/creation/index.ts | 1 - .../src/components/GddTransactionList.spec.js | 78 +++++++++---------- .../src/components/GddTransactionList.vue | 5 +- 3 files changed, 39 insertions(+), 45 deletions(-) diff --git a/backend/src/seeds/creation/index.ts b/backend/src/seeds/creation/index.ts index 598a76cd7..8c7b35a45 100644 --- a/backend/src/seeds/creation/index.ts +++ b/backend/src/seeds/creation/index.ts @@ -127,7 +127,6 @@ bobsSendings.forEach((sending) => { confirmed: true, }) }) -// Wolle: console.log('bobsSum: ', bobsSum) export const creations: CreationInterface[] = [ { diff --git a/frontend/src/components/GddTransactionList.spec.js b/frontend/src/components/GddTransactionList.spec.js index b792cc3cc..a6d0ef935 100644 --- a/frontend/src/components/GddTransactionList.spec.js +++ b/frontend/src/components/GddTransactionList.spec.js @@ -407,29 +407,34 @@ describe('GddTransactionList', () => { }) describe('pagination buttons', () => { + const createTransaction = (idx) => { + return { + amount: '3.14', + balanceDate: '2021-04-29T17:26:40+00:00', + decay: { + decay: '-477.01', + start: '2021-05-13T17:46:31.000Z', + end: '2022-04-20T06:51:25.000Z', + duration: 29509494, + }, + memo: 'Kreiszahl PI', + linkedUser: { + firstName: 'Bibi', + lastName: 'Bloxberg', + }, + id: idx + 1, + typeId: 'RECEIVE', + balance: '33.33', + } + } + beforeEach(async () => { + const transactionCount = 42 await wrapper.setProps({ - transactions: Array.from({ length: 42 }, (_, idx) => { - return { - amount: '3.14', - balanceDate: '2021-04-29T17:26:40+00:00', - decay: { - decay: '-477.01', - start: '2021-05-13T17:46:31.000Z', - end: '2022-04-20T06:51:25.000Z', - duration: 29509494, - }, - memo: 'Kreiszahl PI', - linkedUser: { - firstName: 'Bibi', - lastName: 'Bloxberg', - }, - id: idx + 1, - typeId: 'RECEIVE', - balance: '33.33', - } + transactions: Array.from({ length: transactionCount }, (_, idx) => { + return createTransaction(idx) }), - transactionCount: 42, + transactionCount, decayStartBlock, pageSize: 25, showPagination: true, @@ -449,28 +454,21 @@ describe('GddTransactionList', () => { ) }) }) - }) - describe.skip('show no pagination', () => { - // Wolle: beforeEach(async () => { - // await wrapper.setProps({ - // transactions: [], - // transactionCount: 2, - // decayStartBlock, - // pageSize: 25, - // showPagination: false, - // }) - // }) - - it('shows no pagination buttons', async () => { - await wrapper.setProps({ - transactions: [], - transactionCount: 2, - decayStartBlock, - pageSize: 25, - showPagination: false, + describe('show no pagination', () => { + it('shows no pagination buttons', async () => { + const transactionCount = 2 + await wrapper.setProps({ + transactions: Array.from({ length: transactionCount }, (_, idx) => { + return createTransaction(idx) + }), + transactionCount, + decayStartBlock, + pageSize: 25, + showPagination: false, + }) + expect(wrapper.find('ul.pagination').exists()).toBe(false) }) - expect(wrapper.find('ul.pagination').exists()).toBe(false) }) }) }) diff --git a/frontend/src/components/GddTransactionList.vue b/frontend/src/components/GddTransactionList.vue index abc9ecb0e..5becfa39e 100644 --- a/frontend/src/components/GddTransactionList.vue +++ b/frontend/src/components/GddTransactionList.vue @@ -125,10 +125,6 @@ export default { }, computed: { isPaginationVisible() { - // Wolle: console.log('this.showPagination: ', this.showPagination) - // console.log('this.pageSize: ', this.pageSize) - // console.log('this.transactions.length: ', this.transactions.length) - // console.log('this.transactionCount: ', this.transactionCount) return this.showPagination && this.pageSize < this.transactionCount }, }, @@ -143,6 +139,7 @@ export default { }, } +