Skip to content

Commit 309ee76

Browse files
committed
linting
1 parent 0e5d66f commit 309ee76

3 files changed

Lines changed: 2 additions & 23 deletions

File tree

src/frontend/src/pages/FinancePage/FinanceComponents/PieChart.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ const FinancePieChart: React.FC<FinancePieChartProps> = ({
2525
}) => {
2626
const [isLegendOpen, setIsLegendOpen] = useState(true);
2727

28-
// Combine pending categories into one
2928
const pendingReimbursement = pendingLeadership + pendingFinance + submittedToSABO;
3029

3130
const [sectionStates, setSectionStates] = useState([

src/frontend/src/pages/ProjectDetailPage/ProjectViewContainer/ProjectDetails.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import LoadingIndicator from '../../../components/LoadingIndicator';
2020
import PieChart from '../../FinancePage/FinanceComponents/PieChart';
2121
import WarningBanner from '../../../components/WarningBanner';
2222
import { Box } from '@mui/system';
23-
import ProjectSpendingHistory from '../../ProjectPage/ProjectSpendingHistory';
2423

2524
export const getProjectTeamsName = (project: { teams: { teamName: string }[] }): string => {
2625
return project.teams.map((team) => team.teamName).join(', ');

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

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ const ProjectSpendingHistory: React.FC<ProjectSpendingHistoryProps> = ({ wbsNum
4747
const [openRows, setOpenRows] = useState<Record<string, boolean>>({});
4848
const [showFilters, setShowFilters] = useState(false);
4949

50-
// Filter states
5150
const [submitterFilter, setSubmitterFilter] = useState('');
5251
const [statusFilter, setStatusFilter] = useState('');
5352
const [dateFromFilter, setDateFromFilter] = useState('');
@@ -56,22 +55,15 @@ const ProjectSpendingHistory: React.FC<ProjectSpendingHistoryProps> = ({ wbsNum
5655
const [amountMaxFilter, setAmountMaxFilter] = useState('');
5756

5857
const grouped = useMemo(() => {
59-
// Return empty array if any required data is missing
6058
if (!allReimbursementRequests || !project) return [];
6159

62-
// Create a map of reimbursement requests that are linked to this project
6360
const requestMap = new Map<string, { request: ReimbursementRequest; materials: Material[] }>();
6461

65-
// First, find all reimbursement requests that are directly linked to this project
6662
allReimbursementRequests.forEach((rr) => {
6763
const hasProjectProduct = rr.reimbursementProducts.some((product) => {
6864
const reason = product.reimbursementProductReason;
69-
// Check if it's a WBS element and matches our project
7065
if ((reason as WBSElementData).wbsNum) {
71-
return equalsWbsNumber(
72-
{ ...(reason as WBSElementData).wbsNum, workPackageNumber: 0 }, // Convert to project WBS
73-
wbsNum
74-
);
66+
return equalsWbsNumber((reason as WBSElementData).wbsNum, { ...wbsNum, workPackageNumber: 0 });
7567
}
7668
return false;
7769
});
@@ -81,12 +73,10 @@ const ProjectSpendingHistory: React.FC<ProjectSpendingHistoryProps> = ({ wbsNum
8173
}
8274
});
8375

84-
// Then, add BOM materials ONLY for reimbursement requests that are already linked to this project
8576
if (materials && materials.length > 0) {
8677
materials.forEach((mat) => {
8778
const rr = mat.reimbursementRequest;
8879
if (rr && requestMap.has(rr.reimbursementRequestId)) {
89-
// Only add the material if the RR is already linked to this project
9080
requestMap.get(rr.reimbursementRequestId)!.materials.push(mat);
9181
}
9282
});
@@ -95,10 +85,8 @@ const ProjectSpendingHistory: React.FC<ProjectSpendingHistoryProps> = ({ wbsNum
9585
return Array.from(requestMap.values());
9686
}, [materials, allReimbursementRequests, project, wbsNum]);
9787

98-
// Filter the grouped data
9988
const filteredData = useMemo(() => {
10089
return grouped.filter(({ request }) => {
101-
// Submitter filter
10290
if (submitterFilter) {
10391
const submitterName =
10492
`${request.recipient?.firstName} ${request.recipient?.lastName}` || request.recipient?.email || '';
@@ -107,15 +95,12 @@ const ProjectSpendingHistory: React.FC<ProjectSpendingHistoryProps> = ({ wbsNum
10795
}
10896
}
10997

110-
// Status filter
11198
if (statusFilter) {
11299
const currentStatus = request.reimbursementStatuses?.[0]?.type || '';
113100
if (currentStatus !== statusFilter) {
114101
return false;
115102
}
116103
}
117-
118-
// Date range filter
119104
const requestDate = new Date(request.dateCreated);
120105
if (dateFromFilter) {
121106
const fromDate = new Date(dateFromFilter);
@@ -125,13 +110,12 @@ const ProjectSpendingHistory: React.FC<ProjectSpendingHistoryProps> = ({ wbsNum
125110
}
126111
if (dateToFilter) {
127112
const toDate = new Date(dateToFilter);
128-
toDate.setHours(23, 59, 59, 999); // End of day
113+
toDate.setHours(23, 59, 59, 999);
129114
if (requestDate > toDate) {
130115
return false;
131116
}
132117
}
133118

134-
// Amount range filter
135119
const amount = (request.totalCost || 0) / 100;
136120
if (amountMinFilter) {
137121
const minAmount = parseFloat(amountMinFilter);
@@ -150,7 +134,6 @@ const ProjectSpendingHistory: React.FC<ProjectSpendingHistoryProps> = ({ wbsNum
150134
});
151135
}, [grouped, submitterFilter, statusFilter, dateFromFilter, dateToFilter, amountMinFilter, amountMaxFilter]);
152136

153-
// Get unique submitters and statuses for filter dropdowns
154137
const uniqueSubmitters = useMemo(() => {
155138
const submitters = new Set<string>();
156139
grouped.forEach(({ request }) => {
@@ -185,7 +168,6 @@ const ProjectSpendingHistory: React.FC<ProjectSpendingHistoryProps> = ({ wbsNum
185168

186169
if (isLoading) return <Typography>Loading spending history...</Typography>;
187170

188-
// Handle specific errors
189171
if (rrError) {
190172
console.error('Failed to load reimbursement requests:', rrErrorDetails);
191173
return <Typography color="error">Failed to load spending history.</Typography>;
@@ -196,7 +178,6 @@ const ProjectSpendingHistory: React.FC<ProjectSpendingHistoryProps> = ({ wbsNum
196178
return <Typography color="error">Failed to load spending history.</Typography>;
197179
}
198180

199-
// If we have no data but no errors, show "no spending history"
200181
if (!grouped.length) return <Typography>No spending history for this project.</Typography>;
201182

202183
const handleToggleRow = (id: string) => {

0 commit comments

Comments
 (0)