Skip to content

Commit

Permalink
MAN-82 fix further sonar code exception issue
Browse files Browse the repository at this point in the history
  • Loading branch information
neil-mills committed Jan 29, 2025
1 parent b9d0841 commit 4a0884c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion server/middleware/validation/activityLog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ const activityLog: Route<void> = (req, res, next) => {
}
}

const isEmpty = (nameProp: string, dateVal: string): void => {
const text = properties.errorMessages['activity-log'][nameProp].errors.isEmpty
const name = toCamelCase(nameProp)
errors = utils.addError(errors, { text, anchor: name })
isValid[name] = false
}

const isDateInFuture = (nameProp: string, dateVal: string): void => {
const dateFromIso = getIsoDate(dateVal)
const today = DateTime.now()
Expand Down Expand Up @@ -85,7 +92,7 @@ const activityLog: Route<void> = (req, res, next) => {
errors = utils.addError(errors, { text, anchor: 'dateTo' })
isValid.dateTo = false
}
if (dateFrom && isValid.dateFrom && dateIsValid('dateTo')) {
if (dateIsValid('dateFrom') && dateIsValid('dateTo')) {
const dateFromIso = getIsoDate(dateFrom)
const dateToIso = getIsoDate(dateTo)
if (dateFromIso > dateToIso) {
Expand Down

0 comments on commit 4a0884c

Please sign in to comment.