Skip to content

Commit

Permalink
#2808 used filter to make function less verbose
Browse files Browse the repository at this point in the history
  • Loading branch information
Jalen Wu authored and Jalen Wu committed Sep 19, 2024
1 parent 3bc421e commit 5b3b38d
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions src/frontend/src/utils/work-package.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,5 @@ export const getTitleFromFormType = (formType: WPFormType, wbsElement: WbsElemen
* @returns a list of work packages that are overdue.
*/
export const getOverdueWorkPackages = (wpList: WorkPackage[]): WorkPackage[] => {
const overdueWorkPackages: WorkPackage[] = [];

for (let i = 0; i < wpList.length; i++) {
const curr = wpList[i];

// if the work package is anything but complete and the end date is before today, it is overdue.
if (curr.status !== WbsElementStatus.Complete && curr.endDate < new Date()) {
overdueWorkPackages.push(curr);
}
}

return overdueWorkPackages;
return wpList.filter((wp) => wp.status !== WbsElementStatus.Complete && wp.endDate < new Date());
};

0 comments on commit 5b3b38d

Please sign in to comment.