From e25a651d26f7cdcf3171d1f56d016e24747a7654 Mon Sep 17 00:00:00 2001 From: Ali BARIN Date: Wed, 8 May 2024 13:06:40 +0000 Subject: [PATCH] fix(ynab/low-account-balance): scope trigger by year and month --- .../you-need-a-budget/triggers/low-account-balance/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/backend/src/apps/you-need-a-budget/triggers/low-account-balance/index.js b/packages/backend/src/apps/you-need-a-budget/triggers/low-account-balance/index.js index b7886cc5..2eeacae3 100644 --- a/packages/backend/src/apps/you-need-a-budget/triggers/low-account-balance/index.js +++ b/packages/backend/src/apps/you-need-a-budget/triggers/low-account-balance/index.js @@ -1,3 +1,4 @@ +import { DateTime } from 'luxon'; import defineTrigger from '../../../../helpers/define-trigger.js'; export default defineTrigger({ @@ -18,6 +19,7 @@ export default defineTrigger({ ], async run($) { + const monthYear = DateTime.now().toFormat('MM-yyyy'); const balanceBelowAmount = $.step.parameters.balanceBelowAmount; const formattedBalance = balanceBelowAmount * 1000; @@ -29,7 +31,7 @@ export default defineTrigger({ $.pushTriggerItem({ raw: account, meta: { - internalId: account.id, + internalId: `${account.id}-${monthYear}`, }, }); }