Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#2808: Added work package util function to get overdue WPs #2842

Merged
merged 3 commits into from
Sep 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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());
};
Loading