From 7048cfbce48c4c476aa07d5c9486410c131b882a Mon Sep 17 00:00:00 2001 From: Ash Date: Tue, 25 Jun 2024 12:51:02 +0100 Subject: [PATCH] sonar fix --- server/models/views/alerts-and-warnings.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/server/models/views/alerts-and-warnings.js b/server/models/views/alerts-and-warnings.js index a053bdf55..0a109a20f 100644 --- a/server/models/views/alerts-and-warnings.js +++ b/server/models/views/alerts-and-warnings.js @@ -21,17 +21,18 @@ class ViewModel { floodRiskUrl: config.floodRiskUrl }) - const pageTitle = place?.name ?? location + if (this.station && this.station.agency_name) { + this.pageTitle = `${this.station.agency_name} - flood alerts and warnings` + } else { + const pageTitle = place?.name ?? location + + this.pageTitle = `${pageTitle ? pageTitle + ' - f' : 'F'}lood alerts and warnings` + } if (error) { this.pageTitle = 'Sorry, there is currently a problem searching a location' - } else { - if (this.station && this.station.agency_name) { - this.pageTitle = `${this.station.agency_name} - flood alerts and warnings` - } else { - this.pageTitle = `${pageTitle ? pageTitle + ' - f' : 'F'}lood alerts and warnings` - } } + this.countFloods = floods?.floods?.length ?? 0 this.floods = floods?.groups?.map(item => item)