Skip to content

Commit 03bad7c

Browse files
committed
#4074 filter out denied rrs
1 parent d89a5f4 commit 03bad7c

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

src/frontend/src/pages/ProjectPage/ProjectSpendingHistory.tsx

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ import { useAllReimbursementRequests } from '../../hooks/finance.hooks';
55
import { useSingleProject } from '../../hooks/projects.hooks';
66
import { WbsNumber, ReimbursementRequest, WBSElementData, equalsWbsNumber, ReimbursementStatusType } from 'shared';
77
import LoadingIndicator from '../../components/LoadingIndicator';
8-
import { createReimbursementRequestRowData, cleanReimbursementRequestStatus } from '../../utils/reimbursement-request.utils';
8+
import {
9+
createReimbursementRequestRowData,
10+
cleanReimbursementRequestStatus,
11+
getCurrentReimbursementStatus
12+
} from '../../utils/reimbursement-request.utils';
913
import NERDataGrid, { MapRowResult } from '../../components/NERDataGrid';
1014
import { routes } from '../../utils/routes';
1115
import { fullNamePipe, centsToDollar, datePipe } from '../../utils/pipes';
@@ -49,8 +53,9 @@ const ProjectSpendingHistory: React.FC<ProjectSpendingHistoryProps> = ({ wbsNum
4953

5054
const reimbursementRequests = useMemo(() => {
5155
if (!allReimbursementRequests || !project) return [];
52-
return allReimbursementRequests.filter((rr) =>
53-
rr.reimbursementProducts.some((product) => {
56+
return allReimbursementRequests.filter((rr) => {
57+
if (getCurrentReimbursementStatus(rr.reimbursementStatuses).type == 'DENIED') return false; // exclude denied requests
58+
return rr.reimbursementProducts.some((product) => {
5459
const reason = product.reimbursementProductReason;
5560
if ((reason as WBSElementData).wbsNum) {
5661
return equalsWbsNumber(
@@ -59,8 +64,8 @@ const ProjectSpendingHistory: React.FC<ProjectSpendingHistoryProps> = ({ wbsNum
5964
);
6065
}
6166
return false;
62-
})
63-
);
67+
});
68+
});
6469
}, [allReimbursementRequests, project, wbsNum]);
6570

6671
const budgetInfo = useMemo(() => {

0 commit comments

Comments
 (0)