Skip to content

Commit

Permalink
Merge pull request #506 from bcgov/prod-fix-cr2
Browse files Browse the repository at this point in the history
fix with no formatting
  • Loading branch information
jenbeckett authored Apr 17, 2024
2 parents ea77882 + 460463c commit adb76ee
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 15 deletions.
10 changes: 6 additions & 4 deletions backend/src/components/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 1 addition & 2 deletions frontend/src/components/requestChanges/ReportChanges.vue
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,7 @@ export default {
};
});
}
console.log('all change reqz');
console.log(allChangeRequests);
return allChangeRequests;
},
getPrevProgramYearId(){
Expand Down
35 changes: 26 additions & 9 deletions frontend/src/store/modules/reportChanges.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
}

},
Expand All @@ -185,17 +185,34 @@ export default {
response = await ApiService.apiAxios.get(ApiRoutes.APPLICATION_CHANGE_REQUEST + '/' + applicationIds);

if (!isEmpty(response)) {
response.data.forEach(element => {
element.createdOnDate = new Date(element.createdOnDate).toLocaleDateString();
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 }
)
);
}
});
});
}
}

/*Ministry requirements want change request shown in the order of:
Expand All @@ -211,7 +228,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;
Expand Down

0 comments on commit adb76ee

Please sign in to comment.