diff --git a/back-end/apps/api/src/transactions/groups/transaction-groups.controller.spec.ts b/back-end/apps/api/src/transactions/groups/transaction-groups.controller.spec.ts index ba9e75093..877e4513a 100644 --- a/back-end/apps/api/src/transactions/groups/transaction-groups.controller.spec.ts +++ b/back-end/apps/api/src/transactions/groups/transaction-groups.controller.spec.ts @@ -61,6 +61,7 @@ describe('TransactionGroupsController', () => { sequential: false, groupItems: [], createdAt: new Date(), + groupValidStart: new Date(), }; }); @@ -72,6 +73,7 @@ describe('TransactionGroupsController', () => { atomic: false, sequential: false, groupItems: [], + groupValidStart: new Date(), }; transactionGroupsService.createTransactionGroup.mockResolvedValue(result); diff --git a/back-end/apps/api/src/transactions/groups/transaction-groups.service.spec.ts b/back-end/apps/api/src/transactions/groups/transaction-groups.service.spec.ts index 9ed76aedf..a1f2fd9f0 100644 --- a/back-end/apps/api/src/transactions/groups/transaction-groups.service.spec.ts +++ b/back-end/apps/api/src/transactions/groups/transaction-groups.service.spec.ts @@ -111,6 +111,7 @@ describe('TransactionGroupsService', () => { }, }, ], + groupValidStart: new Date(), }; dataSource.manager.create.mockImplementation((entity, data) => ({ ...data })); diff --git a/front-end/src/renderer/stores/storeTransactionGroup.ts b/front-end/src/renderer/stores/storeTransactionGroup.ts index 827bb105a..5f368bd2a 100644 --- a/front-end/src/renderer/stores/storeTransactionGroup.ts +++ b/front-end/src/renderer/stores/storeTransactionGroup.ts @@ -43,6 +43,7 @@ const useTransactionGroupStore = defineStore('transactionGroup', () => { if (modified.value) { return; } + groupItems.value = []; const group = await getGroup(id); description.value = group.description; @@ -53,6 +54,7 @@ const useTransactionGroupStore = defineStore('transactionGroup', () => { groupValidStart.value = new Date(); } } + const items = await getGroupItems(id); const drafts = await getDrafts(findArgs); const groupItemsToAdd: GroupItem[] = []; @@ -189,7 +191,7 @@ const useTransactionGroupStore = defineStore('transactionGroup', () => { await updateGroup( groupItems.value[0].groupId, userId, - { description, atomic: false }, + { description, atomic: false, groupValidStart: groupValidStart }, groupItems.value, ); } @@ -238,7 +240,8 @@ const useTransactionGroupStore = defineStore('transactionGroup', () => { function updateTransactionValidStarts(newGroupValidStart: Date) { groupItems.value = groupItems.value.map((item, index) => { - if (item.validStart < newGroupValidStart) { + const now = new Date(); + if (item.validStart < now) { const updatedValidStart = findUniqueValidStart( item.payerAccountId, newGroupValidStart.getTime() + index,