From 2972b11ad6a103a6719a9a94f23791529be94e57 Mon Sep 17 00:00:00 2001
From: jannisvisser
Date: Fri, 19 Jan 2024 15:53:36 +0100
Subject: [PATCH] feat: if intermediate only show portal in warning state
AB#25873
---
.../event-speech-bubble.component.html | 3 ++-
interfaces/IBF-dashboard/src/assets/i18n/en.json | 5 ++++-
.../admin-area-dynamic-data.service.ts | 10 ++++++----
services/API-service/src/api/event/event.service.ts | 5 ++---
4 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/interfaces/IBF-dashboard/src/app/components/event-speech-bubble/event-speech-bubble.component.html b/interfaces/IBF-dashboard/src/app/components/event-speech-bubble/event-speech-bubble.component.html
index c0f02e568..88096c655 100644
--- a/interfaces/IBF-dashboard/src/app/components/event-speech-bubble/event-speech-bubble.component.html
+++ b/interfaces/IBF-dashboard/src/app/components/event-speech-bubble/event-speech-bubble.component.html
@@ -88,7 +88,8 @@
| translate
: {
firstLeadTimeDate: event.firstLeadTimeDate,
- eventName: event.eventName?.split('_')[0]
+ eventName: event.eventName?.split('_')[0],
+ disasterTypeLabel: disasterTypeLabel
}
"
>
diff --git a/interfaces/IBF-dashboard/src/assets/i18n/en.json b/interfaces/IBF-dashboard/src/assets/i18n/en.json
index 221f8e058..77460b073 100644
--- a/interfaces/IBF-dashboard/src/assets/i18n/en.json
+++ b/interfaces/IBF-dashboard/src/assets/i18n/en.json
@@ -144,13 +144,16 @@
},
"active-event-active-trigger": {
"header": "Trigger: {{ disasterTypeLabel }}",
- "welcome": "A {{ disasterTypeLabel }} trigger warning was issued on {{ startDate }}."
+ "header-below-trigger": "Warning: {{ disasterTypeLabel }}",
+ "welcome": "A {{ disasterTypeLabel }} trigger was issued on {{ startDate }}.",
+ "welcome-below-trigger": "A warning for {{ disasterTypeLabel }} was issued on {{ startDate }}."
},
"active-event-no-trigger": {
"welcome": "There is no active trigger 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 {{ startDate }} and ended on {{ endDate }}. These actions stay visible here for 7 days after the end-date."
},
"active-event": {
"overview": "There are {{ nrTriggeredAreas }} {{ 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 {{ nrTriggeredAreas }} {{ 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 }}: {{ placeName }}{{ parentName }}",
"exposed": "Exposed Population:"
diff --git a/services/API-service/src/api/admin-area-dynamic-data/admin-area-dynamic-data.service.ts b/services/API-service/src/api/admin-area-dynamic-data/admin-area-dynamic-data.service.ts
index 0ae58c8e8..5b8033ca5 100644
--- a/services/API-service/src/api/admin-area-dynamic-data/admin-area-dynamic-data.service.ts
+++ b/services/API-service/src/api/admin-area-dynamic-data/admin-area-dynamic-data.service.ts
@@ -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 =
@@ -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;
}
}
diff --git a/services/API-service/src/api/event/event.service.ts b/services/API-service/src/api/event/event.service.ts
index 06c907b86..9740c4aae 100644
--- a/services/API-service/src/api/event/event.service.ts
+++ b/services/API-service/src/api/event/event.service.ts
@@ -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(
@@ -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 {
@@ -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;