Skip to content

Commit

Permalink
Merge pull request #209 from europeana/feat/MET-6118-Remove-Null-Valu…
Browse files Browse the repository at this point in the history
…es-From-Country-Data

MET-6118 Handle nulls in country data
  • Loading branch information
andyjmaclean authored Oct 25, 2024
2 parents 457b89f + 932400a commit 90b7b98
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/app/country/country.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ <h1 class="page-title">
cardSummary;
context: {
valName: valName,
value: latestCountryData[valName],
value: latestCountryData[valName] || 0,
percent: latestCountryPercentages[valName] || 0,
isPowerLevel: true
}
Expand Down
6 changes: 3 additions & 3 deletions src/app/country/country.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ export class CountryComponent extends SubscriptionManager {

Object.values(TargetFieldName).forEach((valName: string) => {
const countryName = isoCountryCodesReversed[this.country];
const value = this.latestCountryData[valName];
const value = this.latestCountryData[valName] || 0;
const fmtName = this.renameTargetTypePipe.transform(valName);
const fmtValue = fmtNum(value, '1.0-2');
const itemPluralString = `item${value === 1 ? '' : 's'}`;
Expand Down Expand Up @@ -417,8 +417,8 @@ export class CountryComponent extends SubscriptionManager {
const targets = this.targetMetaData[this.country][valName];

this.latestCountryPercentageOfTargets[valName] = [
(value || 0) / targets[0].value,
(value || 0) / targets[1].value
value / targets[0].value,
value / targets[1].value
].map((val: number) => {
return val * 100;
});
Expand Down

0 comments on commit 90b7b98

Please sign in to comment.