Skip to content

Commit

Permalink
Merge pull request #164 from bcgov/sdci-113
Browse files Browse the repository at this point in the history
fixed district router sometimes failing on .find()
  • Loading branch information
michaeltangbcgov authored Apr 25, 2024
2 parents 2e22a9e + 52ef152 commit c78a956
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-n-deploy-backend-to-ocp-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,6 @@ jobs:
oc rollout status dc/${{ env.IMAGE_NAME }}
- name: ZAP Scan
uses: zaproxy/action-full-scan@v0.3.0
uses: zaproxy/action-full-scan@v0.10.0
with:
target: "https://${{ env.HOST_ROUTE }}"
2 changes: 1 addition & 1 deletion .github/workflows/deploy-to.openshift-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,6 @@ jobs:
oc rollout status dc/${{ env.IMAGE_NAME }}
- name: ZAP Scan
uses: zaproxy/action-full-scan@v0.3.0
uses: zaproxy/action-full-scan@v0.10.0
with:
target: "https://${{ env.HOST_ROUTE }}"
2 changes: 1 addition & 1 deletion .github/workflows/deploy-to.openshift-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,6 @@ jobs:
oc rollout status dc/${{ env.IMAGE_NAME }}
- name: ZAP Scan
uses: zaproxy/action-full-scan@v0.3.0
uses: zaproxy/action-full-scan@v0.10.0
with:
target: "https://${{ env.HOST_ROUTE }}"
10 changes: 5 additions & 5 deletions backend/src/components/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function removeFieldsByCriteria(inputData, criteria) {
}
function appendMailingAddressDetailsAndRemoveAddresses(data) {
if (data && data.addresses && data.addresses.length > 0) {
const physicalAddress = data.addresses.find(
const physicalAddress = data.addresses?.find(
(address) => address.addressTypeCode === "PHYSICAL"
);
if (physicalAddress) {
Expand All @@ -101,7 +101,7 @@ function appendMailingAddressDetailsAndRemoveAddresses(data) {

// Remove the "addresses" property
}
const courierAddress = data.addresses.find(
const courierAddress = data.addresses?.find(
(address) => address.addressTypeCode === "MAILING"
);
if (courierAddress) {
Expand Down Expand Up @@ -132,7 +132,7 @@ function appendMailingAddressDetailsAndRemoveAddresses(data) {
function addDistrictLabels(jsonData, districtList) {
if (jsonData.content && Array.isArray(jsonData.content)) {
jsonData.content.forEach((dataItem) => {
const district = districtList.find(
const district = districtList?.find(
(item) => item.districtId === dataItem.districtId
);
if (district) {
Expand Down Expand Up @@ -229,7 +229,7 @@ function normalizeJsonObject(
includeFields
) {
return sourceArray.map((item) => {
const matchingItem = referenceArray.find(
const matchingItem = referenceArray?.find(
(info) =>
info[matchKey] === item[matchKey] && (!condition || condition(info))
);
Expand Down Expand Up @@ -402,7 +402,7 @@ function createSchoolCache(schoolData, schoolGrades) {
});

// Extract and format principal contact information if it exists
const principalContact = school.contacts.find(
const principalContact = school.contacts?.find(
(contact) => contact.schoolContactTypeCode === "PRINCIPAL"
);
if (principalContact) {
Expand Down

0 comments on commit c78a956

Please sign in to comment.