Skip to content

Commit

Permalink
Merge pull request #709 from palladiumkenya/feat/new-reporting-layer
Browse files Browse the repository at this point in the history
Fixed arithmetic bug on date calculations
  • Loading branch information
cbrianbet authored Mar 18, 2024
2 parents c27969b + 08cfeda commit 95e03e4
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,16 @@ export class GetNumberTestedPositivityHandler
}

if (query.fromDate) {
numberTestedPositivitySql.andWhere(`year >= year(${query.fromDate}01)`);
numberTestedPositivitySql.andWhere(`month >= month(${query.fromDate}01)`);
numberTestedPositivitySql.andWhere(`year >= ${query.fromDate.substring(0, 4)}`);
numberTestedPositivitySql.andWhere(`month >= ${query.fromDate.substring(4)}`);
}

if (query.toDate) {
numberTestedPositivitySql.andWhere(
`year <= year(EOMONTH(${query.fromDate}01))`,
`year <= ${query.toDate.substring(0, 4)}`,
);
numberTestedPositivitySql.andWhere(
`month <= month(EOMONTH(${query.fromDate}01))`,
`month <= ${query.toDate.substring(4)}`,
);
}

Expand Down

0 comments on commit 95e03e4

Please sign in to comment.