Skip to content

Commit

Permalink
Merge pull request #2842 from Northeastern-Electric-Racing/#2808-crea…
Browse files Browse the repository at this point in the history
…te-getOverdueWorkPackages-util

#2808: Added work package util function to get overdue WPs
  • Loading branch information
walker-sean authored Sep 23, 2024
2 parents 322d8ac + 5b3b38d commit d4dc72a
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/frontend/src/utils/work-package.utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { WbsElement, wbsPipe } from 'shared';
import { WbsElement, WbsElementStatus, wbsPipe, WorkPackage } from 'shared';
import { WPFormType } from './form';

export const getTitleFromFormType = (formType: WPFormType, wbsElement: WbsElement): string => {
Expand All @@ -11,3 +11,12 @@ export const getTitleFromFormType = (formType: WPFormType, wbsElement: WbsElemen
return `${wbsPipe(wbsElement.wbsNum)} - ${wbsElement.name}`;
}
};

/**
* Given a list of work packages, return the work packages that are overdue.
* @param wpList a list of work packages.
* @returns a list of work packages that are overdue.
*/
export const getOverdueWorkPackages = (wpList: WorkPackage[]): WorkPackage[] => {
return wpList.filter((wp) => wp.status !== WbsElementStatus.Complete && wp.endDate < new Date());
};

0 comments on commit d4dc72a

Please sign in to comment.