Skip to content

Commit

Permalink
🐛 Use 0 if NaN
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary committed Dec 2, 2020
1 parent 1486edb commit 502b32f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/helpers/calculate-response-time.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ export const getResponseTimeForSite = async (
: "down";

return {
day: parseInt(Number(daySum.reduce((p, c) => p + c, 0) / daySum.length).toFixed(0)),
week: parseInt(Number(weekSum.reduce((p, c) => p + c, 0) / weekSum.length).toFixed(0)),
month: parseInt(Number(monthSum.reduce((p, c) => p + c, 0) / monthSum.length).toFixed(0)),
year: parseInt(Number(yearSum.reduce((p, c) => p + c, 0) / yearSum.length).toFixed(0)),
all: parseInt(Number(allSum.reduce((p, c) => p + c, 0) / allSum.length).toFixed(0)),
day: parseInt(Number(daySum.reduce((p, c) => p + c, 0) / daySum.length).toFixed(0)) || 0,
week: parseInt(Number(weekSum.reduce((p, c) => p + c, 0) / weekSum.length).toFixed(0)) || 0,
month: parseInt(Number(monthSum.reduce((p, c) => p + c, 0) / monthSum.length).toFixed(0)) || 0,
year: parseInt(Number(yearSum.reduce((p, c) => p + c, 0) / yearSum.length).toFixed(0)) || 0,
all: parseInt(Number(allSum.reduce((p, c) => p + c, 0) / allSum.length).toFixed(0)) || 0,
currentStatus,
};
};

0 comments on commit 502b32f

Please sign in to comment.