From 18edcb6f8c2335286ef15e4202effe04cf4e6477 Mon Sep 17 00:00:00 2001 From: Gulfaraz Rahman Date: Mon, 1 Jul 2024 16:16:49 +0200 Subject: [PATCH] refactor: simply 3-way logical split into a 2-way split --- services/API-service/src/api/event/event.service.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/services/API-service/src/api/event/event.service.ts b/services/API-service/src/api/event/event.service.ts index 48393be00..b072999d0 100644 --- a/services/API-service/src/api/event/event.service.ts +++ b/services/API-service/src/api/event/event.service.ts @@ -91,15 +91,11 @@ export class EventService { countryCodeISO3, ); - // I spend quite some time on trying to figure out what is the right query to get the event finished summary for the trigger closed email - // I came up with the following query but I am not sure if it is correct and how to test it properly - const sevenDaysAgo = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000); const sixDaysAgo = new Date(Date.now() - 6 * 24 * 60 * 60 * 1000); const eventSummaryQueryBuilder = this.createEventSummaryQueryBuilder( countryCodeISO3, ) - .andWhere('event.endDate > :endDateMin', { endDateMin: sevenDaysAgo }) - .andWhere('event.endDate < :endDateMax', { endDateMax: sixDaysAgo }) + .andWhere('event.endDate > :endDate', { endDate: sixDaysAgo }) .andWhere('event.adminArea IN (:...adminAreaIds)', { adminAreaIds: countryAdminAreaIds, })