Skip to content

Commit

Permalink
Merge pull request #1632 from rodekruis/fix.area-speech-bubble-appear…
Browse files Browse the repository at this point in the history
…s-twice

fix: area speech bbubble appears twice
  • Loading branch information
jannisvisser authored Oct 14, 2024
2 parents 945e7fc + 2d7ea68 commit 60a7a2b
Showing 1 changed file with 22 additions and 11 deletions.
33 changes: 22 additions & 11 deletions services/API-service/src/api/event/event.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,7 @@ export class EventService {
triggeredPlaceCodes,
disasterType,
lastTriggeredDate,
eventName,
);
}

Expand Down Expand Up @@ -410,21 +411,30 @@ export class EventService {
triggeredPlaceCodes: string[],
disasterType: DisasterType,
lastTriggeredDate: DateDto,
eventName?: string,
leadTime?: string,
): Promise<TriggeredArea[]> {
const actionUnit = await this.getActionUnit(disasterType);
const whereFilters = {
placeCode: In(triggeredPlaceCodes),
indicator: actionUnit,
disasterType,
timestamp: MoreThanOrEqual(
this.helperService.getUploadCutoffMoment(
disasterType,
lastTriggeredDate.timestamp,
),
),
};
if (eventName) {
whereFilters['eventName'] = eventName;
}
if (leadTime) {
whereFilters['leadTime'] = leadTime;
}
const areas = await this.adminAreaDynamicDataRepo
.createQueryBuilder('dynamic')
.where({
placeCode: In(triggeredPlaceCodes),
indicator: actionUnit,
disasterType,
timestamp: MoreThanOrEqual(
this.helperService.getUploadCutoffMoment(
disasterType,
lastTriggeredDate.timestamp,
),
),
})
.where(whereFilters)
.leftJoinAndSelect(
AdminAreaEntity,
'area',
Expand Down Expand Up @@ -457,6 +467,7 @@ export class EventService {
'COALESCE("parentUser"."firstName","grandparentUser"."firstName") || \' \' || COALESCE("parentUser"."lastName","grandparentUser"."lastName") AS "displayName"',
])
.getRawMany();

return areas.map((area) => {
return {
placeCode: area.placeCode,
Expand Down

0 comments on commit 60a7a2b

Please sign in to comment.