Skip to content

Commit 11b59e7

Browse files
committed
swap order of schedule checks
1 parent c1419e5 commit 11b59e7

1 file changed

Lines changed: 10 additions & 10 deletions

File tree

app/utils/dose-schedule.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,16 @@ export function getScheduleSummary({
6969
const atScheduleMax = nextSequence > MMR_MAX_SEQUENCE
7070
const createdAt = new Date(vaccination.createdAt)
7171

72+
if (lastValidCreatedAt) {
73+
const gap = differenceInCalendarDays(createdAt, lastValidCreatedAt)
74+
if (gap < MMR_MIN_INTERVAL_DAYS) {
75+
const reason = REASON.LessThan28DaysAfterPrevious
76+
ignoredDoses.push({ vaccination, reason })
77+
recordedDoses.push({ vaccination, kind: 'ignored', reason })
78+
continue
79+
}
80+
}
81+
7282
if (!atScheduleMax) {
7383
const minAgeDate = addMonths(dob, MMR_MIN_AGE_MONTHS[nextSequence])
7484

@@ -83,16 +93,6 @@ export function getScheduleSummary({
8393
}
8494
}
8595

86-
if (lastValidCreatedAt) {
87-
const gap = differenceInCalendarDays(createdAt, lastValidCreatedAt)
88-
if (gap < MMR_MIN_INTERVAL_DAYS) {
89-
const reason = REASON.LessThan28DaysAfterPrevious
90-
ignoredDoses.push({ vaccination, reason })
91-
recordedDoses.push({ vaccination, kind: 'ignored', reason })
92-
continue
93-
}
94-
}
95-
9696
if (atScheduleMax) {
9797
const reason = REASON.ExtraDose
9898
ignoredDoses.push({ vaccination, reason })

0 commit comments

Comments
 (0)