Currently, validateAuditPeriod throws an error if request does not contain year and half values. The reason why those unnecessaries is needed is querying AuditPeriod is based on given year and half.
According to requirement, however, it is enough to figure out the latest AuditPeriod to validate whether the request is overdue or not.
// validateAuditPeriod
1. filter audit period if its `start` date is lower than timestamp
2. filter audit period if its `end` date is bigger than timestamp
3. return true if audit period exists, else throw an ValidationError
Currently,
validateAuditPeriod
throws an error ifrequest
does not containyear
andhalf
values. The reason why those unnecessaries is needed is queryingAuditPeriod
is based on given year and half.According to requirement, however, it is enough to figure out the latest
AuditPeriod
to validate whether the request is overdue or not.