From cb1d8e8486dc686669258ab758f131026526c2aa Mon Sep 17 00:00:00 2001 From: Jen Beckett <115109120+jenbeckett@users.noreply.github.com> Date: Wed, 17 Apr 2024 14:05:43 -0700 Subject: [PATCH 1/2] fix with no formatting --- backend/src/components/application.js | 10 +++--- .../requestChanges/ReportChanges.vue | 3 +- frontend/src/store/modules/reportChanges.js | 34 ++++++++++++++----- 3 files changed, 33 insertions(+), 14 deletions(-) diff --git a/backend/src/components/application.js b/backend/src/components/application.js index c91a16f4..5ae9522c 100644 --- a/backend/src/components/application.js +++ b/backend/src/components/application.js @@ -688,10 +688,12 @@ async function getFacilityChangeData(changeActionId){ log.info(newFacData, 'new fac data before mapping'); newFacData.value.forEach(fac => { - let mappedFacility = new MappableObjectForFront(fac, NewFacilityMappings).toJSON(); - mappedFacility.facilityName = fac.ccof_facility['name']; - mappedFacility.facilityStatus = fac.ccof_facility['ccof_facilitystatus@OData.Community.Display.V1.FormattedValue']; - mappedData.push(mappedFacility); + if (fac.ccof_facility) { + let mappedFacility = new MappableObjectForFront(fac, NewFacilityMappings).toJSON(); + mappedFacility.facilityName = fac.ccof_facility['name']; + mappedFacility.facilityStatus = fac.ccof_facility['ccof_facilitystatus@OData.Community.Display.V1.FormattedValue']; + mappedData.push(mappedFacility); + } }); log.info('faccccc data post mapping', mappedData); diff --git a/frontend/src/components/requestChanges/ReportChanges.vue b/frontend/src/components/requestChanges/ReportChanges.vue index d77a3513..0e8371ce 100644 --- a/frontend/src/components/requestChanges/ReportChanges.vue +++ b/frontend/src/components/requestChanges/ReportChanges.vue @@ -272,8 +272,7 @@ export default { }; }); } - console.log('all change reqz'); - console.log(allChangeRequests); + return allChangeRequests; }, getPrevProgramYearId(){ diff --git a/frontend/src/store/modules/reportChanges.js b/frontend/src/store/modules/reportChanges.js index 19cb5454..1aa85ab8 100644 --- a/frontend/src/store/modules/reportChanges.js +++ b/frontend/src/store/modules/reportChanges.js @@ -184,18 +184,36 @@ export default { if (applicationIds?.length > 0) response = await ApiService.apiAxios.get(ApiRoutes.APPLICATION_CHANGE_REQUEST + '/' + applicationIds); - if (!isEmpty(response)) { - response.data.forEach(element => { - element.createdOnDate = new Date(element.createdOnDate).toLocaleDateString(); + if (!isEmpty(response)) { + for (const element of response.data) { + + + if (element?.changeActions[0]?.facilities?.length === 0) { + continue; + } + element.createdOnDate = new Date( + element.createdOnDate + ).toLocaleDateString(); store.push(element); - //in the future we may not want to assume a new facility change is not the first of the array? + element.changeActions.forEach((changeAction) => { - if (changeAction.changeType == "NEW_FACILITY"){ + if (changeAction.changeType == "NEW_FACILITY") { const newFacilities = changeAction.facilities; - newFacilities?.forEach(facility => commit('navBar/setNavBarFacilityChangeRequest', {facilityId: facility.facilityId, changeRequestNewFacilityId: facility.changeRequestNewFacilityId}, { root: true })); + newFacilities?.forEach((facility) => + commit( + "navBar/setNavBarFacilityChangeRequest", + { + facilityId: facility.facilityId, + changeRequestNewFacilityId: + facility.changeRequestNewFacilityId, + }, + { root: true } + ) + ); } }); - }); + } + // response.data.forEach((element) => {}); } /*Ministry requirements want change request shown in the order of: @@ -211,7 +229,7 @@ export default { }); commit('setChangeRequestStore', store); - console.log('sorted store:' , store); + } catch(e) { console.log(`Failed to get load change req with error - ${e}`); throw e; From 460463c6026e5ba73c21cbac55e0bfbcc66d2236 Mon Sep 17 00:00:00 2001 From: Trevor Richards Date: Wed, 17 Apr 2024 14:31:52 -0700 Subject: [PATCH 2/2] chore: whitespace and comments --- frontend/src/store/modules/reportChanges.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/frontend/src/store/modules/reportChanges.js b/frontend/src/store/modules/reportChanges.js index 1aa85ab8..d68e6a03 100644 --- a/frontend/src/store/modules/reportChanges.js +++ b/frontend/src/store/modules/reportChanges.js @@ -167,8 +167,8 @@ export default { state.changeRequestMap.get(payload.changeRequestId)?.changeActions?.find(el => el.changeType == CHANGE_REQUEST_TYPES.NEW_FACILITY).newFacilities.push(newFacilityObj); } - catch(error){ - // console.log(error); + catch(error) { + // Pass. } }, @@ -184,7 +184,7 @@ export default { if (applicationIds?.length > 0) response = await ApiService.apiAxios.get(ApiRoutes.APPLICATION_CHANGE_REQUEST + '/' + applicationIds); - if (!isEmpty(response)) { + if (!isEmpty(response)) { for (const element of response.data) { @@ -213,7 +213,6 @@ export default { } }); } - // response.data.forEach((element) => {}); } /*Ministry requirements want change request shown in the order of: