Skip to content

Commit

Permalink
fix: replace quinary expression with a variable re-assignment
Browse files Browse the repository at this point in the history
  • Loading branch information
kriscooke committed Nov 30, 2020
1 parent 3f57288 commit cbac6f8
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions app/containers/Admin/ReportingYear/ReportingYearTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,9 @@ function getMostRecentlyClosedYear(query) {
.sort((yearA, yearB) => {
const yearACloseTime = defaultMoment(yearA.node.applicationCloseTime);
const yearBCloseTime = defaultMoment(yearB.node.applicationCloseTime);

return yearACloseTime.isBefore(yearBCloseTime)
? 1
: yearBCloseTime.isBefore(yearACloseTime)
? -1
: 0;
let sortOrder = yearACloseTime === yearBCloseTime ? 0 : 1;
if (yearBCloseTime.isBefore(yearACloseTime)) sortOrder *= -1;
return sortOrder;
});
// Can edit only the most recently closed reporting period
// (unless the next application window has already opened - prevents overlap):
Expand Down

0 comments on commit cbac6f8

Please sign in to comment.