Skip to content

Commit 8c18273

Browse files
authored
Merge pull request #987 from IFRCGo/fix/seasonal-risk-score
Fix seasonal risk score for regional and global page
2 parents d39f4f0 + 894a762 commit 8c18273

File tree

4 files changed

+24
-26
lines changed

4 files changed

+24
-26
lines changed

.changeset/shiny-snakes-sing.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"go-web-app": patch
3+
---
4+
5+
Fix seasonal risk score in regional and global risk watch

app/src/components/domain/RiskSeasonalMap/Filters/index.tsx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ function Filters(props: Props) {
7575
);
7676

7777
return (
78-
<div className={styles.filters}>
78+
<>
7979
<MultiSelectInput
8080
placeholder={strings.riskAllCountries}
8181
name="countries"
@@ -115,21 +115,23 @@ function Filters(props: Props) {
115115
onChange={handleChange}
116116
withSelectAll
117117
/>
118-
<div className={styles.riskScoreAdditionalOptions}>
118+
<div className={styles.additionalOptions}>
119119
<Checkbox
120120
name="normalizeByPopulation"
121121
label={strings.riskNormalize}
122122
value={value.normalizeByPopulation}
123123
onChange={handleChange}
124124
/>
125-
<Checkbox
126-
name="includeCopingCapacity"
127-
label={strings.riskCopingCapacity}
128-
value={value.includeCopingCapacity}
129-
onChange={handleChange}
130-
/>
125+
{value.riskMetric !== 'riskScore' && (
126+
<Checkbox
127+
name="includeCopingCapacity"
128+
label={strings.riskCopingCapacity}
129+
value={value.includeCopingCapacity}
130+
onChange={handleChange}
131+
/>
132+
)}
131133
</div>
132-
</div>
134+
</>
133135
);
134136
}
135137

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
1-
.filters {
2-
display: grid;
3-
grid-gap: var(--go-ui-spacing-md);
4-
grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
5-
6-
.risk-score-additional-options {
7-
grid-column: 1 / -1;
8-
display: flex;
9-
flex-wrap: wrap;
10-
gap: var(--go-ui-spacing-md);
11-
}
1+
.additional-options {
2+
grid-column: 1 / -1;
3+
display: flex;
4+
flex-wrap: wrap;
5+
gap: var(--go-ui-spacing-md);
126
}

app/src/components/domain/RiskSeasonalMap/index.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -666,11 +666,7 @@ function RiskSeasonalMap(props: Props) {
666666

667667
const newValue = filters.riskMetric === 'riskScore'
668668
? riskScoreToCategory(
669-
// NOTE: Risk Scores are multiplited
670-
// by vulnerability (from server)
671-
// So, dividing by 10 to
672-
// correct the range (0 - 100 -> 0 - 10)
673-
item.hazard_type === 'WF' ? value : (value / 10),
669+
value,
674670
item.hazard_type,
675671
) : value;
676672

@@ -697,7 +693,7 @@ function RiskSeasonalMap(props: Props) {
697693
}
698694
}
699695

700-
if (filters.includeCopingCapacity) {
696+
if (filters.riskMetric !== 'riskScore' && filters.includeCopingCapacity) {
701697
const lccFactor = mappings?.lccFactor[
702698
item.country_details.iso3
703699
];
@@ -880,6 +876,7 @@ function RiskSeasonalMap(props: Props) {
880876
<Container
881877
className={_cs(styles.riskSeasonalMapContainer, className)}
882878
heading={strings.riskSeasonalMapHeading}
879+
withGridViewInFilter
883880
filters={(
884881
<Filters
885882
regionId={Number(regionId)}

0 commit comments

Comments
 (0)