Skip to content

Commit

Permalink
Merge pull request #351 from wearepal/designations-component
Browse files Browse the repository at this point in the history
getTotal fn to accomodate NaN
  • Loading branch information
paulthatjazz authored Feb 23, 2024
2 parents 2333748 + f63268d commit f198952
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion app/javascript/projects/modelling/tile_grid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ export class NumericTileGrid extends TileGrid {
}

getTotal(): number {
return this.data.reduce((a, b) => a + b, 0)
return this.data.reduce((a, b) => (isNaN(a) ? 0 : a) + (isNaN(b) ? 0 : b), 0)
}

toJSON(): TileGridJSON {
Expand Down

0 comments on commit f198952

Please sign in to comment.