Skip to content

Commit

Permalink
feat: fix duration calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
9sneha-n committed Sep 30, 2024
1 parent 3aaa590 commit 1a95290
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
7 changes: 3 additions & 4 deletions src/data/repositories/PerformanceOverviewD2Repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ export class PerformanceOverviewD2Repository implements PerformanceOverviewRepos
...baseIndicator,
nationalIncidentStatus: event.incidentStatus,
manager: event.incidentManagerName,
duration: `${moment()
.diff(moment(event.emerged.date), "days")
.toString()}d`,
cases: casesAndDeaths.cases.toString(),
deaths: casesAndDeaths.deaths.toString(),
} as PerformanceOverviewMetrics;
Expand Down Expand Up @@ -215,10 +218,6 @@ export class PerformanceOverviewD2Repository implements PerformanceOverviewRepos
//@ts-ignore
Object.values(metaData.items).find(item => item.code === row[index])?.name ||
"";
} else if (key === "creationDate") {
acc.duration = `${moment().diff(moment(row[index]), "days").toString()}d`;

acc[key] = moment(row[index]).format("YYYY-MM-DD");
} else if (key === "nationalIncidentStatus") {
acc[key] = row[index] as NationalIncidentStatus;
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Id } from "../Ref";
import { NationalIncidentStatus } from "./DiseaseOutbreakEvent";

export type DiseaseNames =
| "AFP"
Expand Down

0 comments on commit 1a95290

Please sign in to comment.