Skip to content

Commit

Permalink
fix(projects): display action entry date instead of start date
Browse files Browse the repository at this point in the history
  • Loading branch information
yomatters committed Oct 30, 2024
1 parent dbaade2 commit 3601ddd
Showing 1 changed file with 23 additions and 13 deletions.
36 changes: 23 additions & 13 deletions src/projects/helpers/apiSlice.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ const addRequest = (
actionId,
allowedOperations,
detailAvailable,
date: (approvedStartDate || requestedStartDate || entryDate).split(
date: (entryDate || approvedStartDate || requestedStartDate).split(
"T"
)[0],
deleteStatus: null,
Expand All @@ -162,8 +162,14 @@ const addRequest = (
.filter((res) => res.isCredit || res.allocated > 0)
.sort(sortResources),
resourcesReason: "",
returnedForCorrections: actions.find((action) => action.returnedForCorrections) ? true : false,
returnedForCorrectionsNotes: actions.map((action) => action.adminComments).join(','),
returnedForCorrections: actions.find(
(action) => action.returnedForCorrections
)
? true
: false,
returnedForCorrectionsNotes: actions
.map((action) => action.adminComments)
.join(","),
showActionsModal: false,
showConfirmModal: false,
showResourcesModal: false,
Expand Down Expand Up @@ -809,16 +815,20 @@ export const apiSlice = createSlice({
state.projectsList = action.payload.projectsList.map((project) => {
const { grantNumber, requestMasterId, requests, status, title } =
project;
const returnedForCorrections = project.requests.filter(r => r.actions.filter(a => a.returnedForCorrections).length > 0).length > 0
const projectStatus =
returnedForCorrections ? "Returned for Corrections" :
status ||
(requests &&
(requests.find(({ timeStatus }) => timeStatus == "current")
? "Active"
: requests[0].timeStatus == "past"
? "Inactive"
: requests[0].status));
const returnedForCorrections =
project.requests.filter(
(r) =>
r.actions.filter((a) => a.returnedForCorrections).length > 0
).length > 0;
const projectStatus = returnedForCorrections
? "Returned for Corrections"
: status ||
(requests &&
(requests.find(({ timeStatus }) => timeStatus == "current")
? "Active"
: requests[0].timeStatus == "past"
? "Inactive"
: requests[0].status));
if (requests) addProject(state, project, projectStatus);
return {
grantNumber: grantNumber || requestMasterId,
Expand Down

0 comments on commit 3601ddd

Please sign in to comment.