Skip to content

Commit

Permalink
refactor: simply 3-way logical split into a 2-way split
Browse files Browse the repository at this point in the history
  • Loading branch information
gulfaraz committed Jul 1, 2024
1 parent ab556a7 commit 18edcb6
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions services/API-service/src/api/event/event.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})
Expand Down

0 comments on commit 18edcb6

Please sign in to comment.