Skip to content

Commit

Permalink
Fixed getting isfinalized, was one day off
Browse files Browse the repository at this point in the history
Signed-off-by: Ephraim Muhia <emuhia@ona.io>
  • Loading branch information
Ephraim Muhia committed Feb 2, 2018
1 parent daa0997 commit c20d607
Showing 1 changed file with 1 addition and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -425,13 +425,8 @@ protected boolean isFinalized(VaccineRepo.Vaccine vaccine, Date date) {
boolean finalized = false;
Date endDate = util.Utils.getCohortEndDate(vaccine, util.Utils.getLastDayOfMonth(date));
if (endDate != null) {
Calendar calendar = Calendar.getInstance();
calendar.setTime(endDate);
calendar.add(Calendar.DATE, 1);
endDate = calendar.getTime();

Date currentDate = new Date();
finalized = !(DateUtils.isSameDay(currentDate, endDate) || currentDate.before(endDate));
finalized = !(DateUtils.isSameDay(currentDate, endDate) || endDate.after(currentDate));
}

return finalized;
Expand Down

0 comments on commit c20d607

Please sign in to comment.