From af9d874fea27cdb1e69bf83a9b635686d6a7f53a Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Mon, 25 Jul 2022 13:29:45 +0200 Subject: [PATCH 01/10] fix: Update contribution_date when Moved by Seed --- backend/src/seeds/factory/creation.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/backend/src/seeds/factory/creation.ts b/backend/src/seeds/factory/creation.ts index 75a765fae..d3f0f78ca 100644 --- a/backend/src/seeds/factory/creation.ts +++ b/backend/src/seeds/factory/creation.ts @@ -35,12 +35,17 @@ export const creationFactory = async ( if (creation.confirmed) { await mutate({ mutation: confirmContribution, variables: { id: pendingCreation.id } }) + const confirmedCreation = await Contribution.findOneOrFail({ id: pendingCreation.id }) + if (creation.moveCreationDate) { const transaction = await Transaction.findOneOrFail({ where: { userId: user.id, creationDate: new Date(creation.creationDate) }, order: { balanceDate: 'DESC' }, }) if (transaction.decay.equals(0) && transaction.creationDate) { + confirmedCreation.contributionDate = new Date( + nMonthsBefore(transaction.creationDate, creation.moveCreationDate), + ) transaction.creationDate = new Date( nMonthsBefore(transaction.creationDate, creation.moveCreationDate), ) @@ -48,6 +53,7 @@ export const creationFactory = async ( nMonthsBefore(transaction.balanceDate, creation.moveCreationDate), ) await transaction.save() + await confirmedCreation.save() } } } else { From ae6fdd51e97c448f99efd7ee1d0a6f46c58aa1a1 Mon Sep 17 00:00:00 2001 From: Moriz Wahl Date: Mon, 25 Jul 2022 14:00:26 +0200 Subject: [PATCH 02/10] use camel case instead of snake case for edit creation field --- admin/src/components/Tables/OpenCreationsTable.spec.js | 2 +- admin/src/components/Tables/OpenCreationsTable.vue | 2 +- admin/src/pages/CreationConfirm.vue | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/admin/src/components/Tables/OpenCreationsTable.spec.js b/admin/src/components/Tables/OpenCreationsTable.spec.js index 2b41a9b96..05f4506d0 100644 --- a/admin/src/components/Tables/OpenCreationsTable.spec.js +++ b/admin/src/components/Tables/OpenCreationsTable.spec.js @@ -66,7 +66,7 @@ const propsData = { }, }, { key: 'moderator', label: 'moderator' }, - { key: 'edit_creation', label: 'edit' }, + { key: 'editCreation', label: 'edit' }, { key: 'confirm', label: 'save' }, ], toggleDetails: false, diff --git a/admin/src/components/Tables/OpenCreationsTable.vue b/admin/src/components/Tables/OpenCreationsTable.vue index 1e61f00b0..dd9ee5015 100644 --- a/admin/src/components/Tables/OpenCreationsTable.vue +++ b/admin/src/components/Tables/OpenCreationsTable.vue @@ -11,7 +11,7 @@ -