Skip to content

Commit

Permalink
feat: if intermediate only show portal in warning state AB#25873
Browse files Browse the repository at this point in the history
  • Loading branch information
jannisvisser committed Jan 19, 2024
1 parent a86fb12 commit 2972b11
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@
| translate
: {
firstLeadTimeDate: event.firstLeadTimeDate,
eventName: event.eventName?.split('_')[0]
eventName: event.eventName?.split('_')[0],
disasterTypeLabel: disasterTypeLabel
}
"
></p>
Expand Down
5 changes: 4 additions & 1 deletion interfaces/IBF-dashboard/src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,16 @@
},
"active-event-active-trigger": {
"header": "Trigger: {{ disasterTypeLabel }}",
"welcome": "A <strong>{{ disasterTypeLabel }}</strong> trigger warning was issued on <strong>{{ startDate }}</strong>."
"header-below-trigger": "Warning: {{ disasterTypeLabel }}",
"welcome": "A <strong>{{ disasterTypeLabel }}</strong> trigger was issued on <strong>{{ startDate }}</strong>.",
"welcome-below-trigger": "A warning for <strong>{{ disasterTypeLabel }}</strong> was issued on <strong>{{ startDate }}</strong>."
},
"active-event-no-trigger": {
"welcome": "There is <strong>no active trigger</strong> any more, as can be seen in the map, which always reflects the latest forecast. However, you can still see here the EAP-actions that relate to the event that started on <strong>{{ startDate }}</strong> and ended on <strong>{{ endDate }}</strong>. These actions stay visible here for 7 days after the end-date."
},
"active-event": {
"overview": "There are <strong>{{ nrTriggeredAreas }}</strong> {{ adminAreaLabelPlural }} triggered. They are listed below in order of {{ actionIndicator}} and are highlighted in the map with a red outline.",
"overview-below-trigger": "There are <strong>{{ nrTriggeredAreas }}</strong> {{ adminAreaLabelPlural }} exposed. They are listed below in order of {{ actionIndicator}}.",
"instruction": "Please select an area to monitor by selecting from the list or on the map and manage the trigger and the preplanned anticipatory actions of each area.",
"place-name": "{{ adminAreaLabel }}: <strong>{{ placeName }}</strong>{{ parentName }}",
"exposed": "Exposed Population:"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,11 @@ export class AdminAreaDynamicDataService {
const eventBelowTrigger =
!trigger &&
!!uploadExposure.eventName &&
[DisasterType.Typhoon, DisasterType.FlashFloods].includes(
uploadExposure.disasterType,
);
[
DisasterType.Typhoon,
DisasterType.FlashFloods,
DisasterType.Floods,
].includes(uploadExposure.disasterType);

const uploadTriggerPerLeadTimeDto = new UploadTriggerPerLeadTimeDto();
uploadTriggerPerLeadTimeDto.countryCodeISO3 =
Expand All @@ -149,7 +151,7 @@ export class AdminAreaDynamicDataService {
exposurePlaceCodes: DynamicDataPlaceCodeDto[],
): boolean {
for (const exposurePlaceCode of exposurePlaceCodes) {
if (Number(exposurePlaceCode.amount) > 0) {
if (Number(exposurePlaceCode.amount) === 1) {
return true;
}
}
Expand Down
5 changes: 2 additions & 3 deletions services/API-service/src/api/event/event.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,6 @@ export class EventService {
}
const result = {};
result['date'] = triggersPerLeadTime[0].date;
result['countryCodeISO3'] = triggersPerLeadTime[0].countryCodeISO3;
for (const leadTimeKey in LeadTime) {
const leadTimeUnit = LeadTime[leadTimeKey];
const leadTimeIsTriggered = triggersPerLeadTime.find(
Expand Down Expand Up @@ -777,7 +776,7 @@ export class EventService {
if (affectedArea) {
eventArea.activeTrigger = true;
eventArea.endDate = endDate;
if (affectedArea.triggerValue > 0) {
if (affectedArea.triggerValue === 1) {
eventArea.thresholdReached = true;
idsToUpdateAboveThreshold.push(eventArea.eventPlaceCodeId);
} else {
Expand Down Expand Up @@ -889,7 +888,7 @@ export class EventService {
const eventArea = new EventPlaceCodeEntity();
eventArea.adminArea = adminArea;
eventArea.eventName = eventName;
eventArea.thresholdReached = area.triggerValue > 0;
eventArea.thresholdReached = area.triggerValue === 1;
eventArea.triggerValue = area.triggerValue;
eventArea.actionsValue = +area.actionsValue;
eventArea.startDate = startDate.timestamp;
Expand Down

0 comments on commit 2972b11

Please sign in to comment.