From c234990d66432ba4ecba0a5f3ff69b0c6507a353 Mon Sep 17 00:00:00 2001 From: Gulfaraz Rahman Date: Tue, 23 Jul 2024 12:38:09 +0200 Subject: [PATCH 01/29] build: remove duplicate port variable --- interfaces/IBF-dashboard/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/interfaces/IBF-dashboard/package.json b/interfaces/IBF-dashboard/package.json index 505730f40..2b733a76f 100644 --- a/interfaces/IBF-dashboard/package.json +++ b/interfaces/IBF-dashboard/package.json @@ -18,8 +18,8 @@ "prestart": "npm install --no-audit --no-fund", "serve:static": "cp www/index.html www/404.html && npx http-server www/ -c-1 --gzip", "set-env-variables": "node ./_set-env-variabes.js", - "start": "ng serve --port=4200", - "start:no-install": "ng serve --port=4200", + "start": "ng serve", + "start:no-install": "ng serve", "start:prod": "npm run build:prod && npm run serve:static", "test:dev": "ng test", "test": "npm run test:dev -- --no-watch --browsers=ChromeHeadless", From 28144819c024fa51d0ed60545dc39793b8f7ec6e Mon Sep 17 00:00:00 2001 From: Gulfaraz Rahman Date: Tue, 23 Jul 2024 12:38:39 +0200 Subject: [PATCH 02/29] build: update browser support for ng-18 --- interfaces/IBF-dashboard/.browserslistrc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/interfaces/IBF-dashboard/.browserslistrc b/interfaces/IBF-dashboard/.browserslistrc index b15c7fae5..08a555315 100644 --- a/interfaces/IBF-dashboard/.browserslistrc +++ b/interfaces/IBF-dashboard/.browserslistrc @@ -2,11 +2,15 @@ # For additional information regarding the format and rule options, please see: # https://github.com/browserslist/browserslist#queries +# For the full list of supported browsers by the Angular framework, please see: +# https://angular.dev/reference/versions#browser-support + # You can see what browsers were selected by your queries by running: # npx browserslist -> 0.5% -last 2 versions +last 2 Chrome versions +last 1 Firefox version +last 2 Edge major versions +last 2 Safari major versions +last 2 iOS major versions Firefox ESR -not dead -not IE 9-11 # For IE 9-11 support, remove 'not'. From 81bf9f61e156ac17f07941e41aacfbd2ee41a6f1 Mon Sep 17 00:00:00 2001 From: Gulfaraz Rahman Date: Tue, 23 Jul 2024 13:14:37 +0200 Subject: [PATCH 03/29] fix: set header logo max height to 50px --- .../API-service/src/api/notification/email/html/base.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/API-service/src/api/notification/email/html/base.html b/services/API-service/src/api/notification/email/html/base.html index 2ef820fc4..a71477988 100644 --- a/services/API-service/src/api/notification/email/html/base.html +++ b/services/API-service/src/api/notification/email/html/base.html @@ -864,13 +864,13 @@ alt="" src="<%= imgLogo %>" style=" - max-width: 332px; + max-height: 50px; padding: 8px; display: inline !important; vertical-align: bottom; " class="mcnImage" - width="332" + height="50" align="middle" /> From b02b4d8208c14edb77ff91100b8fdfdef6fba07a Mon Sep 17 00:00:00 2001 From: Gulfaraz Rahman Date: Tue, 23 Jul 2024 13:52:07 +0200 Subject: [PATCH 04/29] fix: use consistent font size, alignments, and button styles #1512 --- .../email/html/notification-actions.html | 9 +++------ .../email/html/social-media-link.html | 19 +++---------------- 2 files changed, 6 insertions(+), 22 deletions(-) diff --git a/services/API-service/src/api/notification/email/html/notification-actions.html b/services/API-service/src/api/notification/email/html/notification-actions.html index be5074f41..6f1a1b805 100644 --- a/services/API-service/src/api/notification/email/html/notification-actions.html +++ b/services/API-service/src/api/notification/email/html/notification-actions.html @@ -23,10 +23,7 @@ - @@ -41,7 +38,7 @@ border="0" cellspacing="0" cellpadding="0" - class="notification-action-button notification-action-button-secondary" + class="notification-action-button notification-action-button-primary" >
+ Find more information about the potentially exposed areas, view the map and manage anticipatory actions.
@@ -55,7 +52,7 @@ - diff --git a/services/API-service/src/api/notification/email/html/social-media-link.html b/services/API-service/src/api/notification/email/html/social-media-link.html index 61a111b12..73f34f321 100644 --- a/services/API-service/src/api/notification/email/html/social-media-link.html +++ b/services/API-service/src/api/notification/email/html/social-media-link.html @@ -4,21 +4,11 @@ border="0" cellspacing="0" cellpadding="0" - class="notification-action-button" + class="notification-action-button notification-action-button-primary" > @@ -28,10 +18,7 @@
+ Read about the trigger methodology and the anticipatory actions.
- Join <%- socialMediaType %> group - From 36c2969b61f45e2defbd5f98b95c59b58573eb04 Mon Sep 17 00:00:00 2001 From: Gulfaraz Rahman Date: Tue, 23 Jul 2024 13:56:13 +0200 Subject: [PATCH 05/29] fix: update copy --- .../src/api/notification/email/html/notification-actions.html | 4 ++-- .../src/api/notification/email/html/social-media-link.html | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/services/API-service/src/api/notification/email/html/notification-actions.html b/services/API-service/src/api/notification/email/html/notification-actions.html index 6f1a1b805..fb3050eda 100644 --- a/services/API-service/src/api/notification/email/html/notification-actions.html +++ b/services/API-service/src/api/notification/email/html/notification-actions.html @@ -14,7 +14,7 @@ href="<%= linkDashboard %>" target="_blank" class="body-text body-text-white" - >Go to the IBF-portalOpen IBF @@ -43,7 +43,7 @@ diff --git a/services/API-service/src/api/notification/email/html/social-media-link.html b/services/API-service/src/api/notification/email/html/social-media-link.html index 73f34f321..a10d3ce87 100644 --- a/services/API-service/src/api/notification/email/html/social-media-link.html +++ b/services/API-service/src/api/notification/email/html/social-media-link.html @@ -9,7 +9,7 @@ From 4da1da7191f70ab208e2e88f34154d5dbad4b766 Mon Sep 17 00:00:00 2001 From: Gulfaraz Rahman Date: Tue, 23 Jul 2024 15:05:36 +0200 Subject: [PATCH 06/29] fix: adjust spacing and widths --- .../API-service/src/api/notification/email/html/base.html | 2 +- .../src/api/notification/email/html/notification-actions.html | 4 ++-- .../src/api/notification/email/html/social-media-link.html | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/services/API-service/src/api/notification/email/html/base.html b/services/API-service/src/api/notification/email/html/base.html index a71477988..5116bf226 100644 --- a/services/API-service/src/api/notification/email/html/base.html +++ b/services/API-service/src/api/notification/email/html/base.html @@ -34,6 +34,7 @@ .notification-alerts-table { width: 100%; table-layout: fixed; + min-width: 480px; } .notification-alerts-table-caption { @@ -869,7 +870,6 @@ display: inline !important; vertical-align: bottom; " - class="mcnImage" height="50" align="middle" /> diff --git a/services/API-service/src/api/notification/email/html/notification-actions.html b/services/API-service/src/api/notification/email/html/notification-actions.html index fb3050eda..0f77608ce 100644 --- a/services/API-service/src/api/notification/email/html/notification-actions.html +++ b/services/API-service/src/api/notification/email/html/notification-actions.html @@ -23,7 +23,7 @@
+ Communicate with relevant others about the trigger.
About triggerAbout Trigger
Join <%- socialMediaType %> groupJoin <%- socialMediaType %>
- @@ -52,7 +52,7 @@
+ Find more information about the potentially exposed areas, view the map and manage anticipatory actions. - diff --git a/services/API-service/src/api/notification/email/html/social-media-link.html b/services/API-service/src/api/notification/email/html/social-media-link.html index a10d3ce87..c0548291f 100644 --- a/services/API-service/src/api/notification/email/html/social-media-link.html +++ b/services/API-service/src/api/notification/email/html/social-media-link.html @@ -18,7 +18,7 @@
+ Read about the trigger methodology and the anticipatory actions.
- From 1415ef01bec75cd9adcdc17f2bd54bcd9ef933fe Mon Sep 17 00:00:00 2001 From: Gulfaraz Rahman Date: Tue, 23 Jul 2024 15:45:06 +0200 Subject: [PATCH 07/29] fix: follow mailchimp footer spec --- .../src/api/notification/email/html/base.html | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/services/API-service/src/api/notification/email/html/base.html b/services/API-service/src/api/notification/email/html/base.html index 5116bf226..9123ac479 100644 --- a/services/API-service/src/api/notification/email/html/base.html +++ b/services/API-service/src/api/notification/email/html/base.html @@ -461,7 +461,7 @@ #templateFooter { /*@editable*/ - background-color: #333333; + background-color: #231a15; /*@editable*/ background-image: none; /*@editable*/ @@ -963,16 +963,18 @@

style=" padding-top: 0; padding-right: 18px; - padding-bottom: 9px; + padding-bottom: 0; padding-left: 18px; " valign="top" > - Want to change how you receive these - emails? You can unsubscribe from this list. + >Click here to unsubscribe from IBF + alerts. + *|LIST:ADDRESSLINE|*
+ *|IF:REWARDS|* *|HTML:REWARDS|* + *|END:IF|*

From 38c17ce3f6201d8a3b68827b08bd3d6ba4aa70a2 Mon Sep 17 00:00:00 2001 From: Gulfaraz Rahman Date: Tue, 23 Jul 2024 15:45:38 +0200 Subject: [PATCH 08/29] fix: ibf footer email link --- services/API-service/src/api/notification/email/html/base.html | 2 +- .../API-service/src/api/notification/email/html/footer.html | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/services/API-service/src/api/notification/email/html/base.html b/services/API-service/src/api/notification/email/html/base.html index 9123ac479..1787f6eeb 100644 --- a/services/API-service/src/api/notification/email/html/base.html +++ b/services/API-service/src/api/notification/email/html/base.html @@ -391,7 +391,7 @@ /*@editable*/ padding-top: 36px; /*@editable*/ - padding-bottom: 54px; + padding-bottom: 8px; } /* diff --git a/services/API-service/src/api/notification/email/html/footer.html b/services/API-service/src/api/notification/email/html/footer.html index c742a474e..a1cb1582c 100644 --- a/services/API-service/src/api/notification/email/html/footer.html +++ b/services/API-service/src/api/notification/email/html/footer.html @@ -13,7 +13,8 @@
Impact-Based Forecasting Portal (IBF) was co-developed by Netherlands Red Cross 510 the together with the <%= countryName %> Red Cross - National Society. For questions contact us at ibf-support@510.global + National Society. Contact us at + ibf-support@510.global.
From aa10c30147dba9077335c851c28441f8044aa2b9 Mon Sep 17 00:00:00 2001 From: Gulfaraz Rahman Date: Tue, 23 Jul 2024 16:09:48 +0200 Subject: [PATCH 09/29] style: typo --- .../api/notification/notification.service.ts | 35 ++++++++++--------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/services/API-service/src/api/notification/notification.service.ts b/services/API-service/src/api/notification/notification.service.ts index 514a03a19..7830e9380 100644 --- a/services/API-service/src/api/notification/notification.service.ts +++ b/services/API-service/src/api/notification/notification.service.ts @@ -30,26 +30,27 @@ export class NotificationService { date?: Date, ): Promise { const apiTestResponse = new NotificationApiTestResponseDto(); - const apiTestReponseActive = await this.sendNotiFicationsActiveEvents( + const apiTestResponseActive = await this.sendNotiFicationsActiveEvents( disasterType, countryCodeISO3, isApiTest, date, ); - if (isApiTest && apiTestReponseActive) { - apiTestResponse.activeEvents = apiTestReponseActive; + if (isApiTest && apiTestResponseActive) { + apiTestResponse.activeEvents = apiTestResponseActive; } if (disasterType === DisasterType.Floods) { // Sending finished events is now for floods only - const apiTestReponseFinished = await this.sendNotificationsFinishedEvents( - countryCodeISO3, - disasterType, - isApiTest, - date, - ); - if (isApiTest && apiTestReponseFinished) { - apiTestResponse.finishedEvents = apiTestReponseFinished; + const apiTestResponseFinished = + await this.sendNotificationsFinishedEvents( + countryCodeISO3, + disasterType, + isApiTest, + date, + ); + if (isApiTest && apiTestResponseFinished) { + apiTestResponse.finishedEvents = apiTestResponseFinished; } } @@ -68,7 +69,7 @@ export class NotificationService { isApiTest: boolean, date?: Date, ): Promise { - const apiTestReponseActive = new NotificationApiTestResponseChannelDto(); + const apiTestResponseActive = new NotificationApiTestResponseChannelDto(); const events = await this.eventService.getEventSummary( countryCodeISO3, @@ -96,7 +97,7 @@ export class NotificationService { date, ); if (isApiTest && messageForApiTest) { - apiTestReponseActive.email = messageForApiTest; + apiTestResponseActive.email = messageForApiTest; } if (country.notificationInfo.useWhatsapp[disasterType]) { this.whatsappService.sendTriggerWhatsapp( @@ -107,7 +108,7 @@ export class NotificationService { } } if (isApiTest) { - return apiTestReponseActive; + return apiTestResponseActive; } } @@ -117,7 +118,7 @@ export class NotificationService { isApiTest: boolean, date?: Date, ): Promise { - const apiTestReponseFinished = new NotificationApiTestResponseChannelDto(); + const apiTestResponseFinished = new NotificationApiTestResponseChannelDto(); const finishedNotifiableEvents = await this.eventService.getEventsSummaryTriggerFinishedMail( countryCodeISO3, @@ -138,7 +139,7 @@ export class NotificationService { date, ); if (isApiTest && emailFinished) { - apiTestReponseFinished.email = emailFinished; + apiTestResponseFinished.email = emailFinished; } if (country.notificationInfo.useWhatsapp[disasterType]) { @@ -151,7 +152,7 @@ export class NotificationService { } } if (isApiTest) { - return apiTestReponseFinished; + return apiTestResponseFinished; } } } From a4fafe9f0bfc948ae9b9fc41911722ff5a06623c Mon Sep 17 00:00:00 2001 From: Gulfaraz Rahman Date: Tue, 23 Jul 2024 16:12:51 +0200 Subject: [PATCH 10/29] style: typo --- .../API-service/src/api/notification/notification.service.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/API-service/src/api/notification/notification.service.ts b/services/API-service/src/api/notification/notification.service.ts index 7830e9380..dd71039ae 100644 --- a/services/API-service/src/api/notification/notification.service.ts +++ b/services/API-service/src/api/notification/notification.service.ts @@ -30,7 +30,7 @@ export class NotificationService { date?: Date, ): Promise { const apiTestResponse = new NotificationApiTestResponseDto(); - const apiTestResponseActive = await this.sendNotiFicationsActiveEvents( + const apiTestResponseActive = await this.sendNotificationsActiveEvents( disasterType, countryCodeISO3, isApiTest, @@ -63,7 +63,7 @@ export class NotificationService { } } - private async sendNotiFicationsActiveEvents( + private async sendNotificationsActiveEvents( disasterType: DisasterType, countryCodeISO3: string, isApiTest: boolean, From 37bcee528889c23734fee3dd1f68b15f0081e897 Mon Sep 17 00:00:00 2001 From: Gulfaraz Rahman Date: Tue, 23 Jul 2024 17:30:27 +0200 Subject: [PATCH 11/29] fix: use disaster type label consistently --- .../notification/email/email-template.service.ts | 12 +++++++----- .../src/api/notification/email/email.service.ts | 6 ++---- .../src/api/notification/email/html/base.html | 13 +++---------- .../src/api/notification/email/html/body-event.html | 10 +++++----- .../src/api/notification/email/html/header.html | 4 ++-- .../api/notification/email/html/table-event.html | 4 ++-- .../email/html/trigger-notification.html | 2 +- 7 files changed, 22 insertions(+), 29 deletions(-) diff --git a/services/API-service/src/api/notification/email/email-template.service.ts b/services/API-service/src/api/notification/email/email-template.service.ts index d70c5661d..ada7df341 100644 --- a/services/API-service/src/api/notification/email/email-template.service.ts +++ b/services/API-service/src/api/notification/email/email-template.service.ts @@ -73,7 +73,8 @@ export class EmailTemplateService { linkDashboard: process.env.DASHBOARD_URL, socialMediaLink: country.notificationInfo.linkSocialMediaUrl, socialMediaType: country.notificationInfo.linkSocialMediaType, - disasterType: emailContent.disasterTypeLabel, + disasterType: emailContent.disasterType, + disasterTypeLabel: emailContent.disasterTypeLabel, footer: this.getFooterHtml(country.countryName), }; return keyValueReplaceObject; @@ -98,7 +99,8 @@ export class EmailTemplateService { socialMediaPart: this.getSocialMediaHtml(country), socialMediaLink: country.notificationInfo.linkSocialMediaUrl, socialMediaType: country.notificationInfo.linkSocialMediaType, - disasterType: disasterTypeLabel, + disasterType: disasterType, + disasterTypeLabel: disasterTypeLabel, footer: this.getFooterHtml(country.countryName), }; return keyValueReplaceObject; @@ -131,7 +133,7 @@ export class EmailTemplateService { sentOnDate: this.getCurrentDateTimeString( emailContent.country.countryCodeISO3, ), - disasterLabel: emailContent.disasterTypeLabel, + disasterTypeLabel: emailContent.disasterTypeLabel, nrOfEvents: emailContent.dataPerEvent.length, timezone: CountryTimeZoneMapping[emailContent.country.countryCodeISO3], }); @@ -243,7 +245,7 @@ export class EmailTemplateService { return emailContent.dataPerEvent .map((event) => { const data = { - hazard: emailContent.disasterTypeLabel, + disasterTypeLabel: emailContent.disasterTypeLabel, triggerStatusLabel: event.triggerStatusLabel, eventName: event.eventName, defaultAdminAreaLabelSingular: @@ -309,7 +311,7 @@ export class EmailTemplateService { const data = { // Event details eventName: event.eventName, - hazard: emailContent.disasterTypeLabel, + disasterTypeLabel: emailContent.disasterTypeLabel, triggerStatusLabel: event.triggerStatusLabel, issuedDate: this.dateObjectToDateTimeString( event.issuedDate, diff --git a/services/API-service/src/api/notification/email/email.service.ts b/services/API-service/src/api/notification/email/email.service.ts index 013008a5d..1b1ef1dd9 100644 --- a/services/API-service/src/api/notification/email/email.service.ts +++ b/services/API-service/src/api/notification/email/email.service.ts @@ -61,9 +61,7 @@ export class EmailService { if (isApiTest) { return emailHtml; } - const emailSubject = `IBF ${( - await this.notificationContentService.getDisasterTypeLabel(disasterType) - ).toLowerCase()} notification`; + const emailSubject = `IBF ${emailContent.disasterTypeLabel} alert`; this.sendEmail( emailSubject, emailHtml, @@ -93,7 +91,7 @@ export class EmailService { if (isApiTest) { return emailHtml; } - const emailSubject = `IBF ${disasterTypeLabel.toLowerCase()} trigger is now below threshold`; + const emailSubject = `IBF ${disasterTypeLabel} trigger is now below threshold`; this.sendEmail( emailSubject, emailHtml, diff --git a/services/API-service/src/api/notification/email/html/base.html b/services/API-service/src/api/notification/email/html/base.html index 1787f6eeb..a250575d6 100644 --- a/services/API-service/src/api/notification/email/html/base.html +++ b/services/API-service/src/api/notification/email/html/base.html @@ -303,9 +303,9 @@ /*@editable*/ border-bottom: 0; /*@editable*/ - padding-top: 32px; + padding-top: 8px; /*@editable*/ - padding-bottom: 32px; + padding-bottom: 8px; } /* @@ -389,7 +389,7 @@ /*@editable*/ border-bottom: 0; /*@editable*/ - padding-top: 36px; + padding-top: 16px; /*@editable*/ padding-bottom: 8px; } @@ -875,13 +875,6 @@ /> -
- - <%- headerEventOverview %> diff --git a/services/API-service/src/api/notification/email/html/body-event.html b/services/API-service/src/api/notification/email/html/body-event.html index c8defba0b..706673b1a 100644 --- a/services/API-service/src/api/notification/email/html/body-event.html +++ b/services/API-service/src/api/notification/email/html/body-event.html @@ -5,13 +5,13 @@ style="color: <%= color %>" > triangleIcon - <%= hazard %> <%= eventName %> + <%= disasterTypeLabel %>: <%= eventName %> <% if (firstTriggerLeadTimeString) { %> - <%= hazard %> expected to start on <%= firstLeadTimeString %>, <%= - firstLeadTimeQuantity %>s from now. + <%= disasterTypeLabel %> expected to start on <%= firstLeadTimeString %>, + <%= firstLeadTimeQuantity %>s from now. <%= disasterIssuedLabel %>: @@ -44,8 +44,8 @@
- This <%= triggerStatusLabel %> was issued by the IBF portal on <%= - issuedDate %> (<%= timezone %>) + This <%= triggerStatusLabel %> was issued by IBF on <%= issuedDate %> (<%= + timezone %>)
diff --git a/services/API-service/src/api/notification/email/html/header.html b/services/API-service/src/api/notification/email/html/header.html index 2fcee9bc5..7c0e1d2e8 100644 --- a/services/API-service/src/api/notification/email/html/header.html +++ b/services/API-service/src/api/notification/email/html/header.html @@ -4,10 +4,10 @@ diff --git a/services/API-service/src/api/notification/email/html/table-event.html b/services/API-service/src/api/notification/email/html/table-event.html index 9e178323b..77127c1ce 100644 --- a/services/API-service/src/api/notification/email/html/table-event.html +++ b/services/API-service/src/api/notification/email/html/table-event.html @@ -13,8 +13,8 @@ width="14" height="14" /> - <%= severityLabel %> <%= triggerStatusLabel %> <%= hazard %>: <%= - eventName %> + <%= severityLabel %> <%= triggerStatusLabel %> <%= disasterTypeLabel + %>: <%= eventName %>
Dear Reader,
-

+
<%- eventListBody %> <%- notificationActions %>
Trigger Statement: From e623a133745ac008b756a8146e88701e7e46dd36 Mon Sep 17 00:00:00 2001 From: Gulfaraz Rahman Date: Tue, 23 Jul 2024 17:32:40 +0200 Subject: [PATCH 12/29] fix: use trigger threshold consistently --- .../dashboard-page/Use_chat_section.feature | 2 +- interfaces/IBF-dashboard/src/assets/i18n/en.json | 4 ++-- .../API-service/src/api/event/event.service.ts | 4 ++-- .../src/api/notification/email/email.service.ts | 2 +- .../notification/email/html/event-finished.html | 2 +- .../src/scripts/json/layer-metadata.json | 14 +++++++------- .../src/scripts/json/notification-info.json | 8 ++++---- 7 files changed, 18 insertions(+), 18 deletions(-) diff --git a/features/IBF-portal-user/dashboard-page/Use_chat_section.feature b/features/IBF-portal-user/dashboard-page/Use_chat_section.feature index 50451b549..636e12512 100644 --- a/features/IBF-portal-user/dashboard-page/Use_chat_section.feature +++ b/features/IBF-portal-user/dashboard-page/Use_chat_section.feature @@ -52,7 +52,7 @@ Feature: View and use chat section When the user views the 2nd speech bubble Then if NON-TRIGGERED it mentions there are 'no triggers' And if TRIGGERED it mentions there is a trigger - And if EVENT-WITHOUT-TRIGGER it mentions an activated event below threshold ('typhoon' only) + And if EVENT-WITHOUT-TRIGGER it mentions an activated event below trigger threshold ('typhoon' only) And it mentions when the event this trigger belongs to first started And it mentions for when the trigger is expected And it mentions the name of the event if applicable ('typhoon' only) diff --git a/interfaces/IBF-dashboard/src/assets/i18n/en.json b/interfaces/IBF-dashboard/src/assets/i18n/en.json index a8f0ad175..d5515f686 100644 --- a/interfaces/IBF-dashboard/src/assets/i18n/en.json +++ b/interfaces/IBF-dashboard/src/assets/i18n/en.json @@ -104,7 +104,7 @@ "header": "Stop {{alertLabel}}", "message": "Are you sure? You are about to stop the {{alertLabel}} in {{ placeCodeName }}.

In case of a new event, the area will be triggered again by the IBF-Portal. But within the current event - even if predictions worsen - the trigger for this area will remain stopped. {{disasterSpecificText}}", "disaster-specific": { - "floods": "(An event closes when the forecast stays below threshold for 7 days.)" + "floods": "(An event closes when the forecast stays below trigger threshold for 7 days.)" }, "confirm": "Yes, stop {{alertLabel}}", "cancel": "No, keep {{alertLabel}}", @@ -114,7 +114,7 @@ "header": "Stop Alert", "message": "Are you sure? You are about to stop the alert in {{ placeCodeName }}.

In case of a new event, a new alert for the area will be given by the IBF-Portal. But within the current event - even if predictions worsen - the alert for this area will remain stopped. {{disasterSpecificText}}", "disaster-specific": { - "heavy-rain": "(An event closes when the forecast stays below threshold for 7 days.)" + "heavy-rain": "(An event closes when the forecast stays below trigger threshold for 7 days.)" }, "confirm": "Yes, stop alert", "cancel": "No, keep alert", diff --git a/services/API-service/src/api/event/event.service.ts b/services/API-service/src/api/event/event.service.ts index c016e676b..80f2cecfe 100644 --- a/services/API-service/src/api/event/event.service.ts +++ b/services/API-service/src/api/event/event.service.ts @@ -965,8 +965,8 @@ export class EventService { }; const expiredEventAreas = await this.eventPlaceCodeRepo.find({ where }); - // Below threshold events can be removed from this table after closing - // Below threshold events are warnings an not triggered. I do not know why they are removed here + // Below trigger threshold events can be removed from this table after closing + // Below trigger threshold events are warnings an not triggered. I do not know why they are removed here const belowThresholdEvents = expiredEventAreas.filter( ({ thresholdReached }) => !thresholdReached, ); diff --git a/services/API-service/src/api/notification/email/email.service.ts b/services/API-service/src/api/notification/email/email.service.ts index 1b1ef1dd9..f89f2de9b 100644 --- a/services/API-service/src/api/notification/email/email.service.ts +++ b/services/API-service/src/api/notification/email/email.service.ts @@ -91,7 +91,7 @@ export class EmailService { if (isApiTest) { return emailHtml; } - const emailSubject = `IBF ${disasterTypeLabel} trigger is now below threshold`; + const emailSubject = `IBF ${disasterTypeLabel} ended`; this.sendEmail( emailSubject, emailHtml, diff --git a/services/API-service/src/api/notification/email/html/event-finished.html b/services/API-service/src/api/notification/email/html/event-finished.html index 188cb295a..572d86c81 100644 --- a/services/API-service/src/api/notification/email/html/event-finished.html +++ b/services/API-service/src/api/notification/email/html/event-finished.html @@ -1,6 +1,6 @@
- <%= disasterTypeLabel %>: <%= eventName %> is now below threshold + <%= disasterTypeLabel %>: <%= eventName %> is now below trigger threshold diff --git a/services/API-service/src/scripts/json/layer-metadata.json b/services/API-service/src/scripts/json/layer-metadata.json index 5f3fc49e2..ac6a5e98a 100644 --- a/services/API-service/src/scripts/json/layer-metadata.json +++ b/services/API-service/src/scripts/json/layer-metadata.json @@ -235,25 +235,25 @@ "active": "yes", "description": { "ETH": { - "floods": "This layer shows the locations of the Global Flood Awareness System (GloFAS) stations. These stations are shown as drop pins with a trigger hazard icon on the map. The drop pins can be shown in navy for below threshold or purple for above threshold depending on the level of river discharge measured.
The GloFAS forecast is used for the trigger. These forecasts are often used by the National Governmental Meteorological Services.

GloFAS version 3.1 is a global integrated hydro-meteorological forecast- and monitoring system that delivers global ensemble river discharge forecasts (limited up to 5 days ahead in this layer) for the large river basins (greater than 1000 km2). The GloFAS 3.1 is based on the LISFLOOD hydrological model.

Methodology presenting the GloFAS probability levels: Methodology presenting the GloFAS probability levels: The ECMWF-ENS meteorological forecast data contains a 51-member ensemble. The 75% trigger-threshold discharge levels are presented as 'trigger-alert' levels agreed on in the EAP. The probability is the percentage of the 51 ensemble members that predicts that the discharge is above the threshold. The administrative areas in the corresponding country are mapped to a specific GloFAS Station, and as such it is determined which areas are triggered when the station exceeds the trigger threshold value (for more informatie see the EAP).

Source Link: https://www.globalfloods.eu/" + "floods": "This layer shows the locations of the Global Flood Awareness System (GloFAS) stations. These stations are shown as drop pins with a trigger hazard icon on the map. The drop pins can be shown in navy for below trigger threshold or purple for above trigger threshold depending on the level of river discharge measured.
The GloFAS forecast is used for the trigger. These forecasts are often used by the National Governmental Meteorological Services.

GloFAS version 3.1 is a global integrated hydro-meteorological forecast- and monitoring system that delivers global ensemble river discharge forecasts (limited up to 5 days ahead in this layer) for the large river basins (greater than 1000 km2). The GloFAS 3.1 is based on the LISFLOOD hydrological model.

Methodology presenting the GloFAS probability levels: Methodology presenting the GloFAS probability levels: The ECMWF-ENS meteorological forecast data contains a 51-member ensemble. The 75% trigger-threshold discharge levels are presented as 'trigger-alert' levels agreed on in the EAP. The probability is the percentage of the 51 ensemble members that predicts that the discharge is above the threshold. The administrative areas in the corresponding country are mapped to a specific GloFAS Station, and as such it is determined which areas are triggered when the station exceeds the trigger threshold value (for more informatie see the EAP).

Source Link: https://www.globalfloods.eu/" }, "KEN": { - "floods": "This layer shows the locations of the Global Flood Awareness System (GloFAS) stations. These stations are shown as drop pins with a trigger hazard icon on the map. The drop pins can be shown in navy for below threshold or purple for above threshold depending on the level of river discharge measured.
The GloFAS forecast is used for the trigger. These forecasts are often used by the National Governmental Meteorological Services.

GloFAS version 3.1 is a global integrated hydro-meteorological forecast- and monitoring system that delivers global ensemble river discharge forecasts (limited up to 5 days ahead in this layer) for the large river basins (greater than 1000 km2). The GloFAS 3.1 is based on the LISFLOOD hydrological model.

Methodology presenting the GloFAS probability levels: Methodology presenting the GloFAS probability levels: The ECMWF-ENS meteorological forecast data contains a 51-member ensemble. The 85% trigger-threshold discharge levels are presented as 'trigger-alert' levels agreed on in the EAP. The probability is the percentage of the 51 ensemble members that predicts that the discharge is above the threshold. The administrative areas in the corresponding country are mapped to a specific GloFAS Station, and as such it is determined which areas are triggered when the station exceeds the trigger threshold value (for more informatie see the EAP).

Source Link: https://www.globalfloods.eu/" + "floods": "This layer shows the locations of the Global Flood Awareness System (GloFAS) stations. These stations are shown as drop pins with a trigger hazard icon on the map. The drop pins can be shown in navy for below trigger threshold or purple for above trigger threshold depending on the level of river discharge measured.
The GloFAS forecast is used for the trigger. These forecasts are often used by the National Governmental Meteorological Services.

GloFAS version 3.1 is a global integrated hydro-meteorological forecast- and monitoring system that delivers global ensemble river discharge forecasts (limited up to 5 days ahead in this layer) for the large river basins (greater than 1000 km2). The GloFAS 3.1 is based on the LISFLOOD hydrological model.

Methodology presenting the GloFAS probability levels: Methodology presenting the GloFAS probability levels: The ECMWF-ENS meteorological forecast data contains a 51-member ensemble. The 85% trigger-threshold discharge levels are presented as 'trigger-alert' levels agreed on in the EAP. The probability is the percentage of the 51 ensemble members that predicts that the discharge is above the threshold. The administrative areas in the corresponding country are mapped to a specific GloFAS Station, and as such it is determined which areas are triggered when the station exceeds the trigger threshold value (for more informatie see the EAP).

Source Link: https://www.globalfloods.eu/" }, "MWI": { - "floods": "This layer shows the locations of the Global Flood Awareness System (GloFAS) stations. These stations are shown as drop pins with a trigger hazard icon on the map. The drop pins can be shown in navy for below threshold or purple for above threshold depending on the level of river discharge measured.
The GloFAS forecast is used for the trigger. These forecasts are often used by the National Governmental Meteorological Services.

GloFAS version 3.1 is a global integrated hydro-meteorological forecast- and monitoring system that delivers global ensemble river discharge forecasts (limited up to 6 days ahead in this layer) for the large river basins (greater than 1000 km2). The GloFAS 3.1 is based on the LISFLOOD hydrological model.

Methodology presenting the GloFAS probability levels: Methodology presenting the GloFAS probability levels: The ECMWF-ENS meteorological forecast data contains a 51-member ensemble. The 60% trigger-threshold discharge levels are presented as 'trigger-alert' levels agreed on in the EAP. The probability is the percentage of the 51 ensemble members that predicts that the discharge is above the threshold. The administrative areas in the corresponding country are mapped to a specific GloFAS Station, and as such it is determined which areas are triggered when the station exceeds the trigger threshold value (for more informatie see the EAP).

Source Link: https://www.globalfloods.eu/" + "floods": "This layer shows the locations of the Global Flood Awareness System (GloFAS) stations. These stations are shown as drop pins with a trigger hazard icon on the map. The drop pins can be shown in navy for below trigger threshold or purple for above trigger threshold depending on the level of river discharge measured.
The GloFAS forecast is used for the trigger. These forecasts are often used by the National Governmental Meteorological Services.

GloFAS version 3.1 is a global integrated hydro-meteorological forecast- and monitoring system that delivers global ensemble river discharge forecasts (limited up to 6 days ahead in this layer) for the large river basins (greater than 1000 km2). The GloFAS 3.1 is based on the LISFLOOD hydrological model.

Methodology presenting the GloFAS probability levels: Methodology presenting the GloFAS probability levels: The ECMWF-ENS meteorological forecast data contains a 51-member ensemble. The 60% trigger-threshold discharge levels are presented as 'trigger-alert' levels agreed on in the EAP. The probability is the percentage of the 51 ensemble members that predicts that the discharge is above the threshold. The administrative areas in the corresponding country are mapped to a specific GloFAS Station, and as such it is determined which areas are triggered when the station exceeds the trigger threshold value (for more informatie see the EAP).

Source Link: https://www.globalfloods.eu/" }, "PHL": { - "floods": "This layer shows the locations of the Global Flood Awareness System (GloFAS) stations. These stations are shown as drop pins with a trigger hazard icon on the map. The drop pins can be shown in navy for below threshold or purple for above threshold depending on the level of river discharge measured.
The GloFAS forecast is used for the trigger. These forecasts are often used by the National Governmental Meteorological Services.

GloFAS version 3.1 is a global integrated hydro-meteorological forecast- and monitoring system that delivers global ensemble river discharge forecasts (limited up to 3 days ahead in this layer) for the large river basins. The GloFAS 3.1 is based on the LISFLOOD hydrological model.

Methodology presenting the GloFAS probability levels: Methodology presenting the GloFAS probability levels: The ECMWF-ENS meteorological forecast data contains a 51-member ensemble. The 70% trigger-threshold discharge levels are presented as 'trigger-alert' levels agreed on in the EAP. The probability is the percentage of the 51 ensemble members that predicts that the discharge is above the threshold. The administrative areas in the corresponding country are mapped to a specific GloFAS Station, and as such it is determined which areas are triggered when the station exceeds the trigger threshold value (for more informatie see the EAP).

Source Link: https://www.globalfloods.eu/" + "floods": "This layer shows the locations of the Global Flood Awareness System (GloFAS) stations. These stations are shown as drop pins with a trigger hazard icon on the map. The drop pins can be shown in navy for below trigger threshold or purple for above trigger threshold depending on the level of river discharge measured.
The GloFAS forecast is used for the trigger. These forecasts are often used by the National Governmental Meteorological Services.

GloFAS version 3.1 is a global integrated hydro-meteorological forecast- and monitoring system that delivers global ensemble river discharge forecasts (limited up to 3 days ahead in this layer) for the large river basins. The GloFAS 3.1 is based on the LISFLOOD hydrological model.

Methodology presenting the GloFAS probability levels: Methodology presenting the GloFAS probability levels: The ECMWF-ENS meteorological forecast data contains a 51-member ensemble. The 70% trigger-threshold discharge levels are presented as 'trigger-alert' levels agreed on in the EAP. The probability is the percentage of the 51 ensemble members that predicts that the discharge is above the threshold. The administrative areas in the corresponding country are mapped to a specific GloFAS Station, and as such it is determined which areas are triggered when the station exceeds the trigger threshold value (for more informatie see the EAP).

Source Link: https://www.globalfloods.eu/" }, "SSD": { - "floods": "This layer shows the locations of the Global Flood Awareness System (GloFAS) stations. These stations are shown as drop pins with a trigger hazard icon on the map. The drop pins can be shown in navy for below threshold or purple for above threshold depending on the level of river discharge measured.
The GloFAS forecast is used for the trigger. These forecasts are often used by the National Governmental Meteorological Services.

GloFAS version 3.1 is a global integrated hydro-meteorological forecast and monitoring system that delivers global ensemble river discharge forecasts (limited up to 3 days ahead in this layer) for the large river basins. The GloFAS 3.1 is based on the LISFLOOD hydrological model.

The methodology presenting the GloFAS probability levels: The ECMWF-ENS meteorological forecast data contains a 51-member ensemble. The 60% trigger-threshold discharge levels is presented as the 'trigger-alert' levels agreed on in the EAP. The probability is the percentage of the 51 ensemble members that predicts that the discharge is above the threshold. The administrative areas in the corresponding country are mapped to specific GloFAS Stations, and as such they determine which areas are triggered when the stations reach /exceed the trigger threshold value (for more information see the EAP in ‘about trigger’).

Glofas stations source: https://www.globalfloods.eu/" + "floods": "This layer shows the locations of the Global Flood Awareness System (GloFAS) stations. These stations are shown as drop pins with a trigger hazard icon on the map. The drop pins can be shown in navy for below trigger threshold or purple for above trigger threshold depending on the level of river discharge measured.
The GloFAS forecast is used for the trigger. These forecasts are often used by the National Governmental Meteorological Services.

GloFAS version 3.1 is a global integrated hydro-meteorological forecast and monitoring system that delivers global ensemble river discharge forecasts (limited up to 3 days ahead in this layer) for the large river basins. The GloFAS 3.1 is based on the LISFLOOD hydrological model.

The methodology presenting the GloFAS probability levels: The ECMWF-ENS meteorological forecast data contains a 51-member ensemble. The 60% trigger-threshold discharge levels is presented as the 'trigger-alert' levels agreed on in the EAP. The probability is the percentage of the 51 ensemble members that predicts that the discharge is above the threshold. The administrative areas in the corresponding country are mapped to specific GloFAS Stations, and as such they determine which areas are triggered when the stations reach /exceed the trigger threshold value (for more information see the EAP in ‘about trigger’).

Glofas stations source: https://www.globalfloods.eu/" }, "UGA": { - "floods": "This layer shows the locations of the Global Flood Awareness System (GloFAS) stations. These stations are shown as drop pins with a trigger hazard icon on the map. The drop pins can be shown in navy for below threshold or purple for above threshold depending on the level of river discharge measured.
The GloFAS forecast is used for the trigger. These forecasts are often used by the National Governmental Meteorological Services.

GloFAS version 3.1 is a global integrated hydro-meteorological forecast- and monitoring system that delivers global ensemble river discharge forecasts (limited up to 5 days ahead in this layer) for the large river basins (greater than 1000 km2). The GloFAS 3.1 is based on the LISFLOOD hydrological model.

Methodology presenting the GloFAS probability levels: Methodology presenting the GloFAS probability levels: The ECMWF-ENS meteorological forecast data contains a 51-member ensemble. The 60% trigger-threshold discharge levels are presented as 'trigger-alert' levels agreed on in the EAP. The probability is the percentage of the 51 ensemble members that predicts that the discharge is above the threshold. The administrative areas in the corresponding country are mapped to a specific GloFAS Station, and as such it is determined which areas are triggered when the station exceeds the trigger threshold value (for more informatie see the EAP).

Source Link: https://www.globalfloods.eu/" + "floods": "This layer shows the locations of the Global Flood Awareness System (GloFAS) stations. These stations are shown as drop pins with a trigger hazard icon on the map. The drop pins can be shown in navy for below trigger threshold or purple for above trigger threshold depending on the level of river discharge measured.
The GloFAS forecast is used for the trigger. These forecasts are often used by the National Governmental Meteorological Services.

GloFAS version 3.1 is a global integrated hydro-meteorological forecast- and monitoring system that delivers global ensemble river discharge forecasts (limited up to 5 days ahead in this layer) for the large river basins (greater than 1000 km2). The GloFAS 3.1 is based on the LISFLOOD hydrological model.

Methodology presenting the GloFAS probability levels: Methodology presenting the GloFAS probability levels: The ECMWF-ENS meteorological forecast data contains a 51-member ensemble. The 60% trigger-threshold discharge levels are presented as 'trigger-alert' levels agreed on in the EAP. The probability is the percentage of the 51 ensemble members that predicts that the discharge is above the threshold. The administrative areas in the corresponding country are mapped to a specific GloFAS Station, and as such it is determined which areas are triggered when the station exceeds the trigger threshold value (for more informatie see the EAP).

Source Link: https://www.globalfloods.eu/" }, "ZMB": { - "floods": "This layer shows the locations of the Global Flood Awareness System (GloFAS) stations. These stations are shown as drop pins with a trigger hazard icon on the map. The drop pins can be shown in navy for below threshold, yellow (minimal risk), orange (medium risk) and purple (above threshold - trigger) depending on the level of river discharge measured.
The GloFAS forecast is used for the trigger. These forecasts are often used by the National Governmental Meteorological Services.

GloFAS version 3.1 is a global integrated hydro-meteorological forecast- and monitoring system that delivers global ensemble river discharge forecasts (limited up to 5 days ahead in this layer) for the large river basins (greater than 1000 km2). The GloFAS 3.1 is based on the LISFLOOD hydrological model.

Methodology presenting the GloFAS probability levels: Methodology presenting the GloFAS probability levels: The ECMWF-ENS meteorological forecast data contains a 51-member ensemble. The 60/70/80% trigger-threshold discharge levels are presented as 'trigger-alert' levels agreed on in the EAP. The probability is the percentage of the 51 ensemble members that predicts that the discharge is above the threshold. The administrative areas in the corresponding country are mapped to a specific GloFAS Station, and as such it is determined which areas are triggered when the station exceeds the trigger threshold value (for more informatie see the EAP).

Source Link: https://www.globalfloods.eu/" + "floods": "This layer shows the locations of the Global Flood Awareness System (GloFAS) stations. These stations are shown as drop pins with a trigger hazard icon on the map. The drop pins can be shown in navy for below trigger threshold, yellow (minimal risk), orange (medium risk) and purple (above trigger threshold - trigger) depending on the level of river discharge measured.
The GloFAS forecast is used for the trigger. These forecasts are often used by the National Governmental Meteorological Services.

GloFAS version 3.1 is a global integrated hydro-meteorological forecast- and monitoring system that delivers global ensemble river discharge forecasts (limited up to 5 days ahead in this layer) for the large river basins (greater than 1000 km2). The GloFAS 3.1 is based on the LISFLOOD hydrological model.

Methodology presenting the GloFAS probability levels: Methodology presenting the GloFAS probability levels: The ECMWF-ENS meteorological forecast data contains a 51-member ensemble. The 60/70/80% trigger-threshold discharge levels are presented as 'trigger-alert' levels agreed on in the EAP. The probability is the percentage of the 51 ensemble members that predicts that the discharge is above the threshold. The administrative areas in the corresponding country are mapped to a specific GloFAS Station, and as such it is determined which areas are triggered when the station exceeds the trigger threshold value (for more informatie see the EAP).

Source Link: https://www.globalfloods.eu/" } } }, diff --git a/services/API-service/src/scripts/json/notification-info.json b/services/API-service/src/scripts/json/notification-info.json index a8c956820..b8346fd2b 100644 --- a/services/API-service/src/scripts/json/notification-info.json +++ b/services/API-service/src/scripts/json/notification-info.json @@ -23,7 +23,7 @@ "initial-single-event": "*IBF alert notification*\n\nAn alert for heavy rain is forecasted for: *[startTimeEvent]*.\n\nTo receive more detailed information reply 'yes' to this message.", "follow-up": "*IBF alert notification*\n\nAn alert for heavy rain is forecasted for: *[startTimeEvent]*.\n\nThere are *[nrTriggeredAreas]* [adminAreaLabel] listed below in order of potentially exposed population.\n[areaList]\nOpen the IBF Portal on a computer to get more information about this alert.", "whatsapp-group": "Please use the designated WhatsApp group ([whatsappGroupLink]) to communicate about this alert.", - "no-trigger-old-event": "The alert formerly activated on *[startDate]* is now below threshold.\n\n", + "no-trigger-old-event": "The alert formerly activated on *[startDate]* is now below trigger threshold.\n\n", "no-trigger": "There is *no alert* currently.", "community-notification": "A new community notification has been received. Go to the IBF portal to see the details of the notification." } @@ -144,7 +144,7 @@ "initial-multi-event": "*IBF notification*\n\nThere are *[nrEvents]* notifications issued for flash floods. The first notification is forecasted for: *[startTimeFirstEvent]*.\n\nTo receive more detailed information reply 'yes' to this message.", "follow-up": "*IBF [triggerState] notification*\n\nA [triggerState] for flash floods is forecasted in *[eventName]*: *[startTimeEvent]*.\n\nThere are *[nrTriggeredAreas]* [adminAreaLabel] listed below in order of potentially exposed population.\n[areaList]\nOpen the IBF Portal on a computer to get more information about this [triggerState].", "whatsapp-group": "Please use the designated WhatsApp group ([whatsappGroupLink]) to communicate about this trigger.", - "no-trigger-old-event": "The trigger warning formerly activated on *[startDate]* is now below threshold.\n\n", + "no-trigger-old-event": "The trigger warning formerly activated on *[startDate]* is now below trigger threshold.\n\n", "no-trigger": "There is *no trigger* currently." } } @@ -167,9 +167,9 @@ "initial-single-event": "*IBF trigger notification*\n\nA trigger for floods is forecasted for: *[startTimeEvent]*.\n\nTo receive more detailed information reply 'yes' to this message.", "follow-up": "*IBF trigger notification*\n\nA triggger for floods is forecasted for: *[startTimeEvent]*.\n\nThere are *[nrTriggeredAreas]* [adminAreaLabel] listed below in order of potentially exposed population.\n[areaList]\nOpen the IBF Portal on a computer to get more information about this trigger.", "whatsapp-group": "Please use the designated WhatsApp group ([whatsappGroupLink]) to communicate about this trigger.\n\nUpdate the early actions that have been done in this form: [externalActionsForm]. Please note that through this form you can only check off actions, but you cannot see which actions have been done already.", - "no-trigger-old-event": "The trigger warning formerly activated on *[startDate]* is now below threshold.\n\n", + "no-trigger-old-event": "The trigger warning formerly activated on *[startDate]* is now below trigger threshold.\n\n", "no-trigger": "There is *no trigger* currently.", - "trigger-finished": "The event will close in the IBF-portal when the forecast stays below threshold for 7 days in a row. Until that time, anticipatory actions can still be managed in the IBF-portal." + "trigger-finished": "The event will close in the IBF-portal when the forecast stays below trigger threshold for 7 days in a row. Until that time, anticipatory actions can still be managed in the IBF-portal." } }, "externalEarlyActionForm": "https://eenew.ifrc.org/x/o3VEUuQG", From d15654eba69e2eb8b3f1e468aa3738b2012e4987 Mon Sep 17 00:00:00 2001 From: Gulfaraz Rahman Date: Tue, 23 Jul 2024 17:45:24 +0200 Subject: [PATCH 13/29] fix: show timezone without underscore --- .../notification/email/email-template.service.ts | 13 +++++++++---- .../src/api/notification/email/html/body-event.html | 2 +- .../api/notification/email/html/event-finished.html | 2 +- .../src/api/notification/email/html/header.html | 2 +- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/services/API-service/src/api/notification/email/email-template.service.ts b/services/API-service/src/api/notification/email/email-template.service.ts index ada7df341..5a9aa311e 100644 --- a/services/API-service/src/api/notification/email/email-template.service.ts +++ b/services/API-service/src/api/notification/email/email-template.service.ts @@ -121,7 +121,7 @@ export class EmailTemplateService { new Date(event.startDate), country.countryCodeISO3, ), - timezone: CountryTimeZoneMapping[country.countryCodeISO3], + timeZone: this.getTimezoneDisplay(country.countryCodeISO3), }), ) .join(''); @@ -135,11 +135,15 @@ export class EmailTemplateService { ), disasterTypeLabel: emailContent.disasterTypeLabel, nrOfEvents: emailContent.dataPerEvent.length, - timezone: CountryTimeZoneMapping[emailContent.country.countryCodeISO3], + timeZone: this.getTimezoneDisplay(emailContent.country.countryCodeISO3), }); return headerEventOverview; } + private getTimezoneDisplay = (countryCodeISO3: string) => { + return CountryTimeZoneMapping[countryCodeISO3].split('_').join(' '); + }; + private getNotificationActionsHtml( country: CountryEntity, linkEapSop: string, @@ -317,8 +321,9 @@ export class EmailTemplateService { event.issuedDate, emailContent.country.countryCodeISO3, ), - timezone: - CountryTimeZoneMapping[emailContent.country.countryCodeISO3], + timeZone: this.getTimezoneDisplay( + emailContent.country.countryCodeISO3, + ), // Lead time details firstLeadTimeString: event.firstLeadTimeString, diff --git a/services/API-service/src/api/notification/email/html/body-event.html b/services/API-service/src/api/notification/email/html/body-event.html index 706673b1a..9ff6b110f 100644 --- a/services/API-service/src/api/notification/email/html/body-event.html +++ b/services/API-service/src/api/notification/email/html/body-event.html @@ -45,7 +45,7 @@
This <%= triggerStatusLabel %> was issued by IBF on <%= issuedDate %> (<%= - timezone %>) + timeZone %>)
diff --git a/services/API-service/src/api/notification/email/html/event-finished.html b/services/API-service/src/api/notification/email/html/event-finished.html index 572d86c81..7fd67f322 100644 --- a/services/API-service/src/api/notification/email/html/event-finished.html +++ b/services/API-service/src/api/notification/email/html/event-finished.html @@ -9,7 +9,7 @@
- This warning was issued by the IBF portal on <%= issuedDate %> (<%= timezone + This warning was issued by the IBF portal on <%= issuedDate %> (<%= timeZone %>)
diff --git a/services/API-service/src/api/notification/email/html/header.html b/services/API-service/src/api/notification/email/html/header.html index 7c0e1d2e8..2e93f08d9 100644 --- a/services/API-service/src/api/notification/email/html/header.html +++ b/services/API-service/src/api/notification/email/html/header.html @@ -7,7 +7,7 @@

<%= nrOfEvents %> <%= disasterTypeLabel %> alerts

- IBF alert sent on <%= sentOnDate %> (<%= timezone %>) + IBF alert sent on <%= sentOnDate %> (<%= timeZone %>) From a9c69a39731b1297c626b97e891cd545f5e061c0 Mon Sep 17 00:00:00 2001 From: Gulfaraz Rahman Date: Tue, 23 Jul 2024 17:45:38 +0200 Subject: [PATCH 14/29] refactor: use timeZone instead of timezone consistently --- .../notification-content/notification-content.service.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/services/API-service/src/api/notification/notification-content/notification-content.service.ts b/services/API-service/src/api/notification/notification-content/notification-content.service.ts index e46c1524b..4fd239d2a 100644 --- a/services/API-service/src/api/notification/notification-content/notification-content.service.ts +++ b/services/API-service/src/api/notification/notification-content/notification-content.service.ts @@ -464,7 +464,7 @@ export class NotificationContentService { countryCodeISO3: string, disasterType: DisasterType, ): Promise { - const timezone = { + const timeZone = { PHL: { label: 'PHT', difference: 8, @@ -475,7 +475,7 @@ export class NotificationContentService { }, }; - if (!Object.keys(timezone).includes(countryCodeISO3)) { + if (!Object.keys(timeZone).includes(countryCodeISO3)) { return null; } @@ -489,11 +489,11 @@ export class NotificationContentService { gmtUploadDate.setTime(gmtUploadDate.getTime() + hours * 60 * 60 * 1000), ); - const hourDiff = timezone[countryCodeISO3]?.difference; + const hourDiff = timeZone[countryCodeISO3]?.difference; const localEventDate = new Date( gmtEventDate.setTime(gmtEventDate.getTime() + hourDiff * 60 * 60 * 1000), ); - const timezoneLabel = timezone[countryCodeISO3]?.label; + const timezoneLabel = timeZone[countryCodeISO3]?.label; return `${localEventDate.getHours()}:00 ${timezoneLabel}`; } } From 0d704a6a32e4410e8eaf6e13680d1a1cd73e21db Mon Sep 17 00:00:00 2001 From: Gulfaraz Rahman Date: Wed, 24 Jul 2024 11:28:36 +0200 Subject: [PATCH 15/29] fix: reduce gap between warning and expected exposed --- .../API-service/src/api/notification/email/html/styles.ejs | 7 +++++-- .../src/api/notification/email/html/table-event.html | 4 +--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/services/API-service/src/api/notification/email/html/styles.ejs b/services/API-service/src/api/notification/email/html/styles.ejs index 74a3f2b0f..704506f8b 100644 --- a/services/API-service/src/api/notification/email/html/styles.ejs +++ b/services/API-service/src/api/notification/email/html/styles.ejs @@ -88,10 +88,13 @@ /* Miscellaneous styles */ .padded-div { - height: 20px; + height: 16px; } .padding-top { - padding-top: 10px; + padding-top: 8px; + } + .padding-bottom { + padding-bottom: 8px; } /* Notification action button styles */ diff --git a/services/API-service/src/api/notification/email/html/table-event.html b/services/API-service/src/api/notification/email/html/table-event.html index 77127c1ce..1bd1631dd 100644 --- a/services/API-service/src/api/notification/email/html/table-event.html +++ b/services/API-service/src/api/notification/email/html/table-event.html @@ -16,15 +16,13 @@ <%= severityLabel %> <%= triggerStatusLabel %> <%= disasterTypeLabel %>: <%= eventName %>
-
Expected exposed <%= defaultAdminAreaLabelPlural %><% if (triggerStatusLabel === 'Trigger') { %> in order of <%= indicatorLabel.toLowerCase() %><% } %>:
-
+ Communicate with relevant others about the trigger.
-

- <%= disasterType %> IBF Notification -

-

- <%= nrOfEvents %> <%= disasterLabel %> alerts + <%= nrOfEvents %> <%= disasterTypeLabel %> alerts

- IBF alert send on <%= sentOnDate %> (<%= timezone %>) + IBF alert sent on <%= sentOnDate %> (<%= timezone %>)
From d327e29e132400e395e683242d3abbe9f2f12e3e Mon Sep 17 00:00:00 2001 From: Gulfaraz Rahman Date: Wed, 24 Jul 2024 11:50:23 +0200 Subject: [PATCH 16/29] fi: use secondary buttons for social and about trigger --- .../src/api/notification/email/html/notification-actions.html | 2 +- .../src/api/notification/email/html/social-media-link.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/services/API-service/src/api/notification/email/html/notification-actions.html b/services/API-service/src/api/notification/email/html/notification-actions.html index 0f77608ce..bba4874c0 100644 --- a/services/API-service/src/api/notification/email/html/notification-actions.html +++ b/services/API-service/src/api/notification/email/html/notification-actions.html @@ -38,7 +38,7 @@ border="0" cellspacing="0" cellpadding="0" - class="notification-action-button notification-action-button-primary" + class="notification-action-button notification-action-button-secondary" >
diff --git a/services/API-service/src/api/notification/email/html/social-media-link.html b/services/API-service/src/api/notification/email/html/social-media-link.html index c0548291f..9967b8d72 100644 --- a/services/API-service/src/api/notification/email/html/social-media-link.html +++ b/services/API-service/src/api/notification/email/html/social-media-link.html @@ -4,7 +4,7 @@ border="0" cellspacing="0" cellpadding="0" - class="notification-action-button notification-action-button-primary" + class="notification-action-button notification-action-button-secondary" >
From eb00b89577c48e75e64f7a06be0340c91c4000e0 Mon Sep 17 00:00:00 2001 From: Gulfaraz Rahman Date: Wed, 24 Jul 2024 12:24:34 +0200 Subject: [PATCH 17/29] fix: sort by lead time and threshold reached --- .../notification-content.service.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/services/API-service/src/api/notification/notification-content/notification-content.service.ts b/services/API-service/src/api/notification/notification-content/notification-content.service.ts index 4fd239d2a..1b5e357ba 100644 --- a/services/API-service/src/api/notification/notification-content/notification-content.service.ts +++ b/services/API-service/src/api/notification/notification-content/notification-content.service.ts @@ -142,7 +142,8 @@ export class NotificationContentService { country: CountryEntity, disasterType: DisasterType, ): Promise { - const sortedEvents = this.sortEventsByLeadTime(activeEvents); + const sortedEvents = + this.sortEventsByLeadTimeAndThresholdReached(activeEvents); const headerEventsRows = []; for await (const event of sortedEvents) { headerEventsRows.push( @@ -244,7 +245,7 @@ export class NotificationContentService { return triggeredAreas; } - private sortEventsByLeadTime( + private sortEventsByLeadTimeAndThresholdReached( arr: EventSummaryCountry[], ): EventSummaryCountry[] { const leadTimeValue = (leadTime: LeadTime): number => @@ -258,7 +259,12 @@ export class NotificationContentService { return 1; } - return 0; + // sort by thresholdReached (true first) + if (a.thresholdReached === b.thresholdReached) { + return 0; + } else { + return a.thresholdReached ? -1 : 1; + } }); } From 545e9812cb119e937e098888ea668a2ebec62cfc Mon Sep 17 00:00:00 2001 From: Gulfaraz Rahman Date: Wed, 24 Jul 2024 12:41:16 +0200 Subject: [PATCH 18/29] fix: table spacing --- .../email/html/notification-actions.html | 67 ++++++------------- .../email/html/social-media-link.html | 31 +++------ .../api/notification/email/html/styles.ejs | 18 +++-- 3 files changed, 41 insertions(+), 75 deletions(-) diff --git a/services/API-service/src/api/notification/email/html/notification-actions.html b/services/API-service/src/api/notification/email/html/notification-actions.html index bba4874c0..8bf39c940 100644 --- a/services/API-service/src/api/notification/email/html/notification-actions.html +++ b/services/API-service/src/api/notification/email/html/notification-actions.html @@ -1,62 +1,33 @@ - - + <%- socialMediaPart %> - - + diff --git a/services/API-service/src/api/notification/email/html/social-media-link.html b/services/API-service/src/api/notification/email/html/social-media-link.html index 9967b8d72..b59a45a2d 100644 --- a/services/API-service/src/api/notification/email/html/social-media-link.html +++ b/services/API-service/src/api/notification/email/html/social-media-link.html @@ -1,27 +1,14 @@ - - + diff --git a/services/API-service/src/api/notification/email/html/styles.ejs b/services/API-service/src/api/notification/email/html/styles.ejs index 704506f8b..e87850c13 100644 --- a/services/API-service/src/api/notification/email/html/styles.ejs +++ b/services/API-service/src/api/notification/email/html/styles.ejs @@ -96,11 +96,18 @@ .padding-bottom { padding-bottom: 8px; } + .padding-left { + padding-left: 8px; + } + .padding-right { + padding-right: 8px; + } /* Notification action button styles */ .notification-action-button { - height: 40px; - width: 200px; + display: block; + height: 22.4px; + width: 150px; font-weight: bold; border: 0px; border-radius: 40px; @@ -109,20 +116,21 @@ .notification-action-button-primary { background-color: #6200ee; } - .notification-action-button.notification-action-button-primary a { + .notification-action-button.notification-action-button-primary { color: #ffffff !important; text-decoration: none !important; } .notification-action-button-secondary { background-color: #ffffff; } - .notification-action-button.notification-action-button-secondary a { + .notification-action-button.notification-action-button-secondary { color: #6200ee !important; text-decoration: none !important; } .button-text-padding { padding: 12px 18px 12px 18px; - border-radius: 3px; + border-radius: 50px; + white-space: nowrap; } /* Notification title styles */ From 135a2077ae4a2a49d1c27bbb61cbe468a8010536 Mon Sep 17 00:00:00 2001 From: Gulfaraz Rahman Date: Wed, 24 Jul 2024 13:06:03 +0200 Subject: [PATCH 19/29] fix: white space no wrap in alert title --- services/API-service/src/api/notification/email/html/styles.ejs | 1 + 1 file changed, 1 insertion(+) diff --git a/services/API-service/src/api/notification/email/html/styles.ejs b/services/API-service/src/api/notification/email/html/styles.ejs index e87850c13..2c2d5b125 100644 --- a/services/API-service/src/api/notification/email/html/styles.ejs +++ b/services/API-service/src/api/notification/email/html/styles.ejs @@ -137,6 +137,7 @@ .notification-title { color: white; text-align: center; + white-space: nowrap; } .full-width-table { From a62a5126b90752eeb59e69f43c19018c3ae4f3b0 Mon Sep 17 00:00:00 2001 From: Gulfaraz Rahman Date: Wed, 24 Jul 2024 14:15:31 +0200 Subject: [PATCH 20/29] feat: use ongoing instead of 0-lead-time --- .../email/email-template.service.ts | 17 +++++++++++++---- .../api/notification/email/html/body-event.html | 7 +++---- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/services/API-service/src/api/notification/email/email-template.service.ts b/services/API-service/src/api/notification/email/email-template.service.ts index 5a9aa311e..ad7bebeb7 100644 --- a/services/API-service/src/api/notification/email/email-template.service.ts +++ b/services/API-service/src/api/notification/email/email-template.service.ts @@ -8,6 +8,7 @@ import { EapAlertClassKeyEnum, EventSummaryCountry, } from '../../../shared/data.model'; +import { LeadTime } from '../../admin-area-dynamic-data/enum/lead-time.enum'; import { CountryTimeZoneMapping } from '../../country/country-time-zone-mapping'; import { CountryEntity } from '../../country/country.entity'; import { DisasterType } from '../../disaster/disaster-type.enum'; @@ -328,10 +329,10 @@ export class EmailTemplateService { // Lead time details firstLeadTimeString: event.firstLeadTimeString, firstTriggerLeadTimeString: event.firstTriggerLeadTimeString, - firstLeadTimeQuantity: event.firstLeadTime.replace('-', ' '), - firstTriggerLeadTimeQuantity: event.firstTriggerLeadTime - ? event.firstTriggerLeadTime.replace('-', ' ') - : '', + firstLeadTimeFromNow: this.getTimeFromNow(event.firstLeadTime), + firstTriggerLeadTimeFromNow: this.getTimeFromNow( + event.firstTriggerLeadTime, + ), // Area details nrOfTriggeredAreas: event.nrOfTriggeredAreas, @@ -374,6 +375,14 @@ export class EmailTemplateService { .join(''); } + private getTimeFromNow(leadTime: LeadTime) { + if (!leadTime) return ''; + + return [LeadTime.day0, LeadTime.month0, LeadTime.hour0].includes(leadTime) + ? 'ongoing' + : `${leadTime.replace('-', ' ')}s from now`; + } + private getDisasterIssuedLabel( eapLabel: string, triggerStatusLabel: TriggerStatusLabelEnum, diff --git a/services/API-service/src/api/notification/email/html/body-event.html b/services/API-service/src/api/notification/email/html/body-event.html index 9ff6b110f..f45b90f16 100644 --- a/services/API-service/src/api/notification/email/html/body-event.html +++ b/services/API-service/src/api/notification/email/html/body-event.html @@ -11,20 +11,19 @@ <% if (firstTriggerLeadTimeString) { %> <%= disasterTypeLabel %> expected to start on <%= firstLeadTimeString %>, - <%= firstLeadTimeQuantity %>s from now. + <%= firstLeadTimeFromNow %>. <%= disasterIssuedLabel %>: expected to reach threshold on <%= firstTriggerLeadTimeString %>, <%= - firstTriggerLeadTimeQuantity %>s from now. + firstTriggerLeadTimeFromNow %>. <% } else { %> <%= disasterIssuedLabel %>: - expected on <%= firstLeadTimeString %>, <%= firstLeadTimeQuantity %>s from - now. + expected on <%= firstLeadTimeString %>, <%= firstLeadTimeFromNow %>. <% } %> From a564d4682e648f98b88b1d9dab60a600739d79ef Mon Sep 17 00:00:00 2001 From: Gulfaraz Rahman Date: Wed, 24 Jul 2024 14:35:34 +0200 Subject: [PATCH 21/29] fix: round the % value to 2 decimal places --- .../notification-content.service.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/services/API-service/src/api/notification/notification-content/notification-content.service.ts b/services/API-service/src/api/notification/notification-content/notification-content.service.ts index 1b5e357ba..4191228f8 100644 --- a/services/API-service/src/api/notification/notification-content/notification-content.service.ts +++ b/services/API-service/src/api/notification/notification-content/notification-content.service.ts @@ -194,9 +194,7 @@ export class NotificationContentService { disasterType, ); - data.totalAffectedOfIndicator = this.getTotalAffectedPerEvent( - data.triggeredAreas, - ); + data.totalAffectedOfIndicator = this.getTotalAffected(data.triggeredAreas); data.mapImage = await this.eventService.getEventMapImage( country.countryCodeISO3, disasterType, @@ -268,8 +266,12 @@ export class NotificationContentService { }); } - private getTotalAffectedPerEvent(adminAreas: TriggeredArea[]) { - return adminAreas.reduce((acc, cur) => acc + cur.actionsValue, 0); + private getTotalAffected(triggeredAreas: TriggeredArea[]) { + return parseFloat( + triggeredAreas + .reduce((acc, triggeredArea) => acc + triggeredArea.actionsValue, 0) + .toFixed(2), + ); } private async getFirstLeadTimeDate( From a7899c9836341d902451a33aedda41c3560d56a0 Mon Sep 17 00:00:00 2001 From: Gulfaraz Rahman Date: Wed, 24 Jul 2024 14:59:21 +0200 Subject: [PATCH 22/29] fix: show total affected if info is available --- .../src/api/notification/email/email-template.service.ts | 7 +++---- ...ted-trigger.html => body-total-affected-available.html} | 0 .../email/html/body-total-affected-unavailable.html | 1 + .../email/html/body-total-affected-warning.html | 1 - 4 files changed, 4 insertions(+), 5 deletions(-) rename services/API-service/src/api/notification/email/html/{body-total-affected-trigger.html => body-total-affected-available.html} (100%) create mode 100644 services/API-service/src/api/notification/email/html/body-total-affected-unavailable.html delete mode 100644 services/API-service/src/api/notification/email/html/body-total-affected-warning.html diff --git a/services/API-service/src/api/notification/email/email-template.service.ts b/services/API-service/src/api/notification/email/email-template.service.ts index ad7bebeb7..0dec48d11 100644 --- a/services/API-service/src/api/notification/email/email-template.service.ts +++ b/services/API-service/src/api/notification/email/email-template.service.ts @@ -406,10 +406,9 @@ export class EmailTemplateService { event: NotificationDataPerEventDto, indicatorUnit: string, ): string { - const fileName = - event.triggerStatusLabel === TriggerStatusLabelEnum.Warning - ? 'body-total-affected-warning.html' - : 'body-total-affected-trigger.html'; + const fileName = event.totalAffectedOfIndicator + ? 'body-total-affected-available.html' + : 'body-total-affected-unavailable.html'; const htmlTemplate = this.readHtmlFile(fileName); return ejs.render(htmlTemplate, { totalAffectedOfIndicator: event.totalAffectedOfIndicator, diff --git a/services/API-service/src/api/notification/email/html/body-total-affected-trigger.html b/services/API-service/src/api/notification/email/html/body-total-affected-available.html similarity index 100% rename from services/API-service/src/api/notification/email/html/body-total-affected-trigger.html rename to services/API-service/src/api/notification/email/html/body-total-affected-available.html diff --git a/services/API-service/src/api/notification/email/html/body-total-affected-unavailable.html b/services/API-service/src/api/notification/email/html/body-total-affected-unavailable.html new file mode 100644 index 000000000..9ee32ad35 --- /dev/null +++ b/services/API-service/src/api/notification/email/html/body-total-affected-unavailable.html @@ -0,0 +1 @@ +Information regarding <%= indicatorUnit %> not available
diff --git a/services/API-service/src/api/notification/email/html/body-total-affected-warning.html b/services/API-service/src/api/notification/email/html/body-total-affected-warning.html deleted file mode 100644 index 6572e5a8e..000000000 --- a/services/API-service/src/api/notification/email/html/body-total-affected-warning.html +++ /dev/null @@ -1 +0,0 @@ -Information regarding <%= indicatorUnit %> not available for warnings
From 02cbb8740cc64cbc65c37baf94b4348b68d925bb Mon Sep 17 00:00:00 2001 From: Gulfaraz Rahman Date: Wed, 24 Jul 2024 15:04:44 +0200 Subject: [PATCH 23/29] fix: update copy --- .../email/html/body-total-affected-unavailable.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/API-service/src/api/notification/email/html/body-total-affected-unavailable.html b/services/API-service/src/api/notification/email/html/body-total-affected-unavailable.html index 9ee32ad35..bf0f8ddae 100644 --- a/services/API-service/src/api/notification/email/html/body-total-affected-unavailable.html +++ b/services/API-service/src/api/notification/email/html/body-total-affected-unavailable.html @@ -1 +1 @@ -Information regarding <%= indicatorUnit %> not available
+The <%= indicatorUnit %> information is unavailable
From 5c209c8f1a4e717ff893d345855bf2ec1d7682d4 Mon Sep 17 00:00:00 2001 From: Gulfaraz Rahman Date: Wed, 24 Jul 2024 15:29:58 +0200 Subject: [PATCH 24/29] data: use integers for population affected --- .../upload-population_affected-1.json | 206 +++++++++--------- 1 file changed, 103 insertions(+), 103 deletions(-) diff --git a/services/API-service/src/api/admin-area-dynamic-data/dto/example/EGY/heavy-rain/upload-population_affected-1.json b/services/API-service/src/api/admin-area-dynamic-data/dto/example/EGY/heavy-rain/upload-population_affected-1.json index c18d76e3b..edb915b56 100644 --- a/services/API-service/src/api/admin-area-dynamic-data/dto/example/EGY/heavy-rain/upload-population_affected-1.json +++ b/services/API-service/src/api/admin-area-dynamic-data/dto/example/EGY/heavy-rain/upload-population_affected-1.json @@ -1,414 +1,414 @@ [ { "placeCode": "Disputed-1", - "amount": 0.0 + "amount": 0 }, { "placeCode": "Disputed-2", - "amount": 0.0 + "amount": 0 }, { "placeCode": "EG001", - "amount": 4245.039 + "amount": 4245 }, { "placeCode": "EG002", - "amount": 6248332.0 + "amount": 6248332 }, { "placeCode": "EG003", - "amount": 6446849.5 + "amount": 6446849 }, { "placeCode": "EG004", - "amount": 3323981.2 + "amount": 3323981 }, { "placeCode": "EG005", - "amount": 5040895.5 + "amount": 5040895 }, { "placeCode": "EG006", - "amount": 4536078.0 + "amount": 4536078 }, { "placeCode": "EG007", - "amount": 7872761.0 + "amount": 7872761 }, { "placeCode": "EG008", - "amount": 3993261.0 + "amount": 3993261 }, { "placeCode": "EG009", - "amount": 4156470.5 + "amount": 4156470 }, { "placeCode": "EG010", - "amount": 8980181.0 + "amount": 8980181 }, { "placeCode": "EG011", - "amount": 5161873.5 + "amount": 5161873 }, { "placeCode": "EG012", - "amount": 175467.77 + "amount": 175467 }, { "placeCode": "EG013", - "amount": 1238355.8 + "amount": 1238355 }, { "placeCode": "EG014", - "amount": 605492.25 + "amount": 605492 }, { "placeCode": "EG015", - "amount": 6361527.0 + "amount": 6361527 }, { "placeCode": "EG016", - "amount": 0.0 + "amount": 0 }, { "placeCode": "EG017", - "amount": 4346435.5 + "amount": 4346435 }, { "placeCode": "EG018", - "amount": 2953946.8 + "amount": 2953946 }, { "placeCode": "EG019", - "amount": 10062.429 + "amount": 10062 }, { "placeCode": "EG020", - "amount": 1366884.6 + "amount": 1366884 }, { "placeCode": "EG021", - "amount": 21529.426 + "amount": 21529 }, { "placeCode": "EG022", - "amount": 3817371.2 + "amount": 3817371 }, { "placeCode": "EG023", - "amount": 506397.75 + "amount": 506397 }, { "placeCode": "EG024", - "amount": 555530.8 + "amount": 555530 }, { "placeCode": "EG025", - "amount": 153480.47 + "amount": 153480 }, { "placeCode": "EG026", - "amount": 1259545.1 + "amount": 1259545 }, { "placeCode": "EG027", - "amount": 0.0 + "amount": 0 }, { "placeCode": "LB101", - "amount": 0.0 + "amount": 0 }, { "placeCode": "LB102", - "amount": 0.0 + "amount": 0 }, { "placeCode": "LB103", - "amount": 0.0 + "amount": 0 }, { "placeCode": "LB104", - "amount": 0.0 + "amount": 0 }, { "placeCode": "LB105", - "amount": 0.0 + "amount": 0 }, { "placeCode": "LY001", - "amount": 0.0 + "amount": 0 }, { "placeCode": "LY002", - "amount": 0.0 + "amount": 0 }, { "placeCode": "LY003", - "amount": 0.0 + "amount": 0 }, { "placeCode": "LY004", - "amount": 0.0 + "amount": 0 }, { "placeCode": "LY005", - "amount": 0.0 + "amount": 0 }, { "placeCode": "LY006", - "amount": 0.0 + "amount": 0 }, { "placeCode": "LY007", - "amount": 0.0 + "amount": 0 }, { "placeCode": "LY008", - "amount": 0.0 + "amount": 0 }, { "placeCode": "LY009", - "amount": 0.0 + "amount": 0 }, { "placeCode": "LY010", - "amount": 0.0 + "amount": 0 }, { "placeCode": "LY011", - "amount": 0.0 + "amount": 0 }, { "placeCode": "LY012", - "amount": 0.0 + "amount": 0 }, { "placeCode": "LY013", - "amount": 0.0 + "amount": 0 }, { "placeCode": "LY014", - "amount": 0.0 + "amount": 0 }, { "placeCode": "LY015", - "amount": 0.0 + "amount": 0 }, { "placeCode": "LY016", - "amount": 0.0 + "amount": 0 }, { "placeCode": "LY017", - "amount": 0.0 + "amount": 0 }, { "placeCode": "LY018", - "amount": 0.0 + "amount": 0 }, { "placeCode": "LY019", - "amount": 0.0 + "amount": 0 }, { "placeCode": "LY020", - "amount": 0.0 + "amount": 0 }, { "placeCode": "LY021", - "amount": 0.0 + "amount": 0 }, { "placeCode": "LY022", - "amount": 0.0 + "amount": 0 }, { "placeCode": "PS001", - "amount": 0.0 + "amount": 0 }, { "placeCode": "PS002", - "amount": 0.0 + "amount": 0 }, { "placeCode": "PS003", - "amount": 0.0 + "amount": 0 }, { "placeCode": "PS004", - "amount": 0.0 + "amount": 0 }, { "placeCode": "PS005", - "amount": 0.0 + "amount": 0 }, { "placeCode": "PS006", - "amount": 0.0 + "amount": 0 }, { "placeCode": "PS007", - "amount": 0.0 + "amount": 0 }, { "placeCode": "PS008", - "amount": 0.0 + "amount": 0 }, { "placeCode": "PS009", - "amount": 0.0 + "amount": 0 }, { "placeCode": "PS010", - "amount": 0.0 + "amount": 0 }, { "placeCode": "PS011", - "amount": 0.0 + "amount": 0 }, { "placeCode": "PS012", - "amount": 0.0 + "amount": 0 }, { "placeCode": "PS013", - "amount": 0.0 + "amount": 0 }, { "placeCode": "PS014", - "amount": 0.0 + "amount": 0 }, { "placeCode": "PS015", - "amount": 0.0 + "amount": 0 }, { "placeCode": "PS016", - "amount": 0.0 + "amount": 0 }, { "placeCode": "SA001", - "amount": 0.0 + "amount": 0 }, { "placeCode": "SA002", - "amount": 0.0 + "amount": 0 }, { "placeCode": "SA003", - "amount": 0.0 + "amount": 0 }, { "placeCode": "SA004", - "amount": 0.0 + "amount": 0 }, { "placeCode": "SA005", - "amount": 0.0 + "amount": 0 }, { "placeCode": "SA006", - "amount": 0.0 + "amount": 0 }, { "placeCode": "SA007", - "amount": 0.0 + "amount": 0 }, { "placeCode": "SA008", - "amount": 0.0 + "amount": 0 }, { "placeCode": "SA009", - "amount": 0.0 + "amount": 0 }, { "placeCode": "SA010", - "amount": 0.0 + "amount": 0 }, { "placeCode": "SA011", - "amount": 0.0 + "amount": 0 }, { "placeCode": "SA012", - "amount": 0.0 + "amount": 0 }, { "placeCode": "SA013", - "amount": 0.0 + "amount": 0 }, { "placeCode": "SD201", - "amount": 0.0 + "amount": 0 }, { "placeCode": "SD202", - "amount": 0.0 + "amount": 0 }, { "placeCode": "SD203", - "amount": 0.0 + "amount": 0 }, { "placeCode": "SD204", - "amount": 0.0 + "amount": 0 }, { "placeCode": "SD205", - "amount": 0.0 + "amount": 0 }, { "placeCode": "SD206", - "amount": 0.0 + "amount": 0 }, { "placeCode": "SD207", - "amount": 0.0 + "amount": 0 }, { "placeCode": "SD208", - "amount": 0.0 + "amount": 0 }, { "placeCode": "SD209", - "amount": 0.0 + "amount": 0 }, { "placeCode": "SD210", - "amount": 0.0 + "amount": 0 }, { "placeCode": "SD211", - "amount": 0.0 + "amount": 0 }, { "placeCode": "SD212", - "amount": 0.0 + "amount": 0 }, { "placeCode": "SD213", - "amount": 0.0 + "amount": 0 }, { "placeCode": "SD214", - "amount": 0.0 + "amount": 0 }, { "placeCode": "SD215", - "amount": 0.0 + "amount": 0 }, { "placeCode": "SD216", - "amount": 0.0 + "amount": 0 }, { "placeCode": "SD217", - "amount": 0.0 + "amount": 0 }, { "placeCode": "SD218", - "amount": 0.0 + "amount": 0 } ] From 4613b3716bd042d88b62a9de4e18b8a61a1a9992 Mon Sep 17 00:00:00 2001 From: Gulfaraz Rahman Date: Wed, 24 Jul 2024 16:04:27 +0200 Subject: [PATCH 25/29] fix: egypt heavy rainfall email --- .../src/api/notification/email/email-template.service.ts | 2 +- .../src/api/notification/email/html/table-event.html | 5 +++-- .../src/api/notification/email/html/table-trigger-row.html | 3 ++- .../src/api/notification/email/html/table-warning-row.html | 3 ++- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/services/API-service/src/api/notification/email/email-template.service.ts b/services/API-service/src/api/notification/email/email-template.service.ts index 0dec48d11..1e50c8657 100644 --- a/services/API-service/src/api/notification/email/email-template.service.ts +++ b/services/API-service/src/api/notification/email/email-template.service.ts @@ -245,7 +245,7 @@ export class EmailTemplateService { private getTablesForEvents(emailContent: ContentEventEmail): string { const adminAreaLabelsParent = emailContent.country.adminRegionLabels[ - String(emailContent.defaultAdminLevel - 1) + String(Math.max(1, emailContent.defaultAdminLevel - 1)) ]; return emailContent.dataPerEvent .map((event) => { diff --git a/services/API-service/src/api/notification/email/html/table-event.html b/services/API-service/src/api/notification/email/html/table-event.html index 1bd1631dd..d2d2fe885 100644 --- a/services/API-service/src/api/notification/email/html/table-event.html +++ b/services/API-service/src/api/notification/email/html/table-event.html @@ -32,8 +32,9 @@ <% } %>
<%- tableRows %> diff --git a/services/API-service/src/api/notification/email/html/table-trigger-row.html b/services/API-service/src/api/notification/email/html/table-trigger-row.html index 5dfe41cd0..2579e03d5 100644 --- a/services/API-service/src/api/notification/email/html/table-trigger-row.html +++ b/services/API-service/src/api/notification/email/html/table-trigger-row.html @@ -3,6 +3,7 @@ <%= affectedOfIndicator %> diff --git a/services/API-service/src/api/notification/email/html/table-warning-row.html b/services/API-service/src/api/notification/email/html/table-warning-row.html index b551f1d03..cc73580be 100644 --- a/services/API-service/src/api/notification/email/html/table-warning-row.html +++ b/services/API-service/src/api/notification/email/html/table-warning-row.html @@ -1,5 +1,6 @@ From 0a76ca6542eb980d5f141d987fecf6182e32fdc1 Mon Sep 17 00:00:00 2001 From: Gulfaraz Rahman Date: Wed, 24 Jul 2024 18:15:23 +0200 Subject: [PATCH 26/29] test: update api tests --- .../test/email/drought/email-uga-drought.test.ts | 3 ++- .../test/email/floods/test-flood-scenario.helper.ts | 8 ++++++-- .../test/email/typhoon/test-typhoon-scenario.helper.ts | 10 ++++++++-- services/API-service/test/helpers/utility.helper.ts | 4 ++++ 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/services/API-service/test/email/drought/email-uga-drought.test.ts b/services/API-service/test/email/drought/email-uga-drought.test.ts index ad781c13b..773768de7 100644 --- a/services/API-service/test/email/drought/email-uga-drought.test.ts +++ b/services/API-service/test/email/drought/email-uga-drought.test.ts @@ -3,6 +3,7 @@ import { JSDOM } from 'jsdom'; import { DisasterType } from '../../../src/api/disaster/disaster-type.enum'; import { getAccessToken, + getEventTitle, mockDynamicData, resetDB, sendNotification, @@ -64,7 +65,7 @@ describe('Should send an email for uga drought', () => { // Check if each expected event name is included in at least one title for (const expectedEventName of expectedEventNames) { - const eventTitle = `${disasterType} ${expectedEventName}`.toLowerCase(); + const eventTitle = getEventTitle(disasterType, expectedEventName); const hasEvent = eventNamesInEmail.some((eventNameInEmail) => eventNameInEmail.includes(eventTitle), ); diff --git a/services/API-service/test/email/floods/test-flood-scenario.helper.ts b/services/API-service/test/email/floods/test-flood-scenario.helper.ts index 30b67375b..a8c524ebe 100644 --- a/services/API-service/test/email/floods/test-flood-scenario.helper.ts +++ b/services/API-service/test/email/floods/test-flood-scenario.helper.ts @@ -3,7 +3,11 @@ import { JSDOM } from 'jsdom'; import { DisasterType } from '../../../src/api/disaster/disaster-type.enum'; import { FloodsScenario } from '../../../src/scripts/enum/mock-scenario.enum'; import disasters from '../../../src/scripts/json/disasters.json'; -import { mockFloods, sendNotification } from '../../helpers/utility.helper'; +import { + getEventTitle, + mockFloods, + sendNotification, +} from '../../helpers/utility.helper'; export interface TestFloodScenarioDto { scenarios: any[]; @@ -56,7 +60,7 @@ export async function testFloodScenario( // Check if there are elements with the desired text content for (const event of eventsSeed) { - const eventTitle = `${disasterTypeLabel} ${event.eventName}`.toLowerCase(); + const eventTitle = getEventTitle(disasterTypeLabel, event.eventName); const hasEvent = eventNamesInEmail.some((eventName) => eventName.includes(eventTitle), ); diff --git a/services/API-service/test/email/typhoon/test-typhoon-scenario.helper.ts b/services/API-service/test/email/typhoon/test-typhoon-scenario.helper.ts index 80ca33af3..25a2863c2 100644 --- a/services/API-service/test/email/typhoon/test-typhoon-scenario.helper.ts +++ b/services/API-service/test/email/typhoon/test-typhoon-scenario.helper.ts @@ -1,8 +1,14 @@ +import { get } from 'http'; + import { JSDOM } from 'jsdom'; import { DisasterType } from '../../../src/api/disaster/disaster-type.enum'; import { TyphoonScenario } from '../../../src/scripts/enum/mock-scenario.enum'; -import { mockTyphoon, sendNotification } from '../../helpers/utility.helper'; +import { + getEventTitle, + mockTyphoon, + sendNotification, +} from '../../helpers/utility.helper'; export async function testTyphoonScenario( scenario: TyphoonScenario, @@ -47,7 +53,7 @@ export async function testTyphoonScenario( // Check if there are elements with the desired text content for (const eventNameInEmail of eventNamesInEmail) { - const eventTitle = `${disasterTypeLabel} ${eventName}`.toLowerCase(); + const eventTitle = getEventTitle(disasterTypeLabel, eventName); const hasEvent = eventNameInEmail.includes(eventTitle); expect(hasEvent).toBe(true); } diff --git a/services/API-service/test/helpers/utility.helper.ts b/services/API-service/test/helpers/utility.helper.ts index 49d91eaee..24d89f880 100644 --- a/services/API-service/test/helpers/utility.helper.ts +++ b/services/API-service/test/helpers/utility.helper.ts @@ -30,6 +30,10 @@ export function getHostname(): string { return 'http://localhost:3000/api'; } +export function getEventTitle(disasterType: string, eventName: string) { + return `${disasterType}: ${eventName}`.toLowerCase(); +} + export function getServer(): TestAgent { return request.agent(getHostname()); } From e1fdb142f155d8e825396c248598ed52fdeea903 Mon Sep 17 00:00:00 2001 From: Gulfaraz Rahman Date: Wed, 24 Jul 2024 18:17:41 +0200 Subject: [PATCH 27/29] fix: lint error --- .../test/email/typhoon/test-typhoon-scenario.helper.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/services/API-service/test/email/typhoon/test-typhoon-scenario.helper.ts b/services/API-service/test/email/typhoon/test-typhoon-scenario.helper.ts index 25a2863c2..5e4f874ed 100644 --- a/services/API-service/test/email/typhoon/test-typhoon-scenario.helper.ts +++ b/services/API-service/test/email/typhoon/test-typhoon-scenario.helper.ts @@ -1,5 +1,3 @@ -import { get } from 'http'; - import { JSDOM } from 'jsdom'; import { DisasterType } from '../../../src/api/disaster/disaster-type.enum'; From 6a804231682391d143a2f428563d9dc43cd479cd Mon Sep 17 00:00:00 2001 From: Gulfaraz Rahman Date: Thu, 25 Jul 2024 20:45:22 +0200 Subject: [PATCH 28/29] fix: use correct color for yellow --- .../src/api/notification/email/email-template.service.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/API-service/src/api/notification/email/email-template.service.ts b/services/API-service/src/api/notification/email/email-template.service.ts index 1e50c8657..bc26997b0 100644 --- a/services/API-service/src/api/notification/email/email-template.service.ts +++ b/services/API-service/src/api/notification/email/email-template.service.ts @@ -421,7 +421,7 @@ export class EmailTemplateService { triggerStatusLabel: TriggerStatusLabelEnum, ): string { const ibfOrange = '#aa6009'; - const ibfYellow = '#7d6906'; + const ibfYellow = '#665606'; const ibfRed = '#8a0f32'; // Color defined in the EAP Alert Class. This is only used for flood events @@ -433,7 +433,7 @@ export class EmailTemplateService { switch (color) { case 'ibf-orange': return ibfOrange; - case 'ibf-yellow': + case 'fiveten-yellow-500': return ibfYellow; default: return ibfRed; From f1e9aba3655ed70d7ba1a62c302167c7faf9747a Mon Sep 17 00:00:00 2001 From: Gulfaraz Rahman Date: Thu, 25 Jul 2024 20:55:09 +0200 Subject: [PATCH 29/29] fix: show indicator value for warnings --- .../src/api/notification/email/email-template.service.ts | 6 +----- .../email/html/{table-trigger-row.html => table-row.html} | 0 .../src/api/notification/email/html/table-warning-row.html | 6 ------ 3 files changed, 1 insertion(+), 11 deletions(-) rename services/API-service/src/api/notification/email/html/{table-trigger-row.html => table-row.html} (100%) delete mode 100644 services/API-service/src/api/notification/email/html/table-warning-row.html diff --git a/services/API-service/src/api/notification/email/email-template.service.ts b/services/API-service/src/api/notification/email/email-template.service.ts index bc26997b0..2d8e7c02f 100644 --- a/services/API-service/src/api/notification/email/email-template.service.ts +++ b/services/API-service/src/api/notification/email/email-template.service.ts @@ -294,11 +294,7 @@ export class EmailTemplateService { private getTablesRows(event: NotificationDataPerEventDto) { return event.triggeredAreas .map((area) => { - const tableRowHtmlFileName = - TriggerStatusLabelEnum.Trigger === event.triggerStatusLabel - ? 'table-trigger-row.html' - : 'table-warning-row.html'; - const areaTemplate = this.readHtmlFile(tableRowHtmlFileName); + const areaTemplate = this.readHtmlFile('table-row.html'); const areaData = { affectedOfIndicator: area.actionsValue, adminBoundary: area.displayName ? area.displayName : area.name, diff --git a/services/API-service/src/api/notification/email/html/table-trigger-row.html b/services/API-service/src/api/notification/email/html/table-row.html similarity index 100% rename from services/API-service/src/api/notification/email/html/table-trigger-row.html rename to services/API-service/src/api/notification/email/html/table-row.html diff --git a/services/API-service/src/api/notification/email/html/table-warning-row.html b/services/API-service/src/api/notification/email/html/table-warning-row.html deleted file mode 100644 index cc73580be..000000000 --- a/services/API-service/src/api/notification/email/html/table-warning-row.html +++ /dev/null @@ -1,6 +0,0 @@ - - -
- + Open IBF - - - -
- Open IBF -
- - - - -
- Find more information about the potentially exposed areas, view - the map and manage anticipatory actions. -
+
  + Find more information about the potentially exposed areas, view the map + and manage anticipatory actions.
- + About Trigger - - - -
- About Trigger -
- - - - -
- Read about the trigger methodology and the anticipatory actions. -
+
  + Read about the trigger methodology and the anticipatory actions.
- + Join <%- socialMediaType %> - - - -
- Join <%- socialMediaType %> -
- - - - -
- Communicate with relevant others about the trigger. -
+
  + Communicate with relevant others about the trigger.
- <%= defaultAdminAreaLabelSingular %> (<%= - defaultAdminAreaLabelParent %>) + <%= defaultAdminAreaLabelSingular %> <% if + (defaultAdminAreaLabelParent != defaultAdminAreaLabelSingular) { + %>(<%= defaultAdminAreaLabelParent %>)<% } %>
- <%= adminBoundary %> (<%= higherAdminBoundary %>) + <%= adminBoundary %> <% if (higherAdminBoundary) { %>(<%= + higherAdminBoundary %>)<% } %>
- <%= adminBoundary %> (<%= higherAdminBoundary %>) + <%= adminBoundary %> <% if (higherAdminBoundary) { %>(<%= + higherAdminBoundary %>)<% } %>
- <%= adminBoundary %> <% if (higherAdminBoundary) { %>(<%= - higherAdminBoundary %>)<% } %> -