From 68d1bdadd80ed1706730e9f80c92c44df797374d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20Harnes?= Date: Wed, 9 Oct 2024 10:26:21 +0200 Subject: [PATCH] Filter out agreements with 0 amount from scheduled avtalegiro --- src/routes/scheduled.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/routes/scheduled.ts b/src/routes/scheduled.ts index 438fea38..02a70f95 100644 --- a/src/routes/scheduled.ts +++ b/src/routes/scheduled.ts @@ -102,6 +102,7 @@ router.post("/avtalegiro", authMiddleware.isAdmin, async (req, res, next) => { if (isClaimDateLastDayOfMonth) { agreements = [...agreements, ...(await DAO.avtalegiroagreements.getByPaymentDate(0))]; } + agreements = agreements.filter((agreement) => agreement.amount > 0); if (agreements.length > 0) { /** @@ -209,6 +210,7 @@ router.post("/avtalegiro/retry", authMiddleware.isAdmin, async (req, res, next) agreements = [...agreements, ...(await DAO.avtalegiroagreements.getByPaymentDate(0))]; } + agreements = agreements.filter((agreement) => agreement.amount > 0); if (agreements.length > 0) { /** * Notify agreements to be charged