Skip to content

Commit

Permalink
Merge pull request #120 from bcgov/extractuatfix
Browse files Browse the repository at this point in the history
fixed extracts empy columsn and empty rows
  • Loading branch information
michaeltangbcgov authored Nov 23, 2023
2 parents 6e85398 + d4ed221 commit 1567572
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
11 changes: 6 additions & 5 deletions backend/src/routes/district-router.js
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,11 @@ async function getAllDistrictContacts(req, res) {
const propertyOrder = [
{ property: "districtId_districtNumber", label: "District Number" },
{ property: "districtId_displayName", label: "District Name" },
{ property: "description", label: "District Contact" },
{ property: "districtContactTypeCode_description", label: "District Contact" },
{ property: "firstName", label: "Contact First Name" },
{ property: "lastName", label: "Contact Last name" },
{ property: "jobTitle", label: "Position Title" },
{ property: "label", label: "Contact Type" },
{ property: "districtContactTypeCode_label", label: "Contact Type" },
{ property: "districtId_mailing_addressLine1", label: "Address Line 1" },
{ property: "districtId_mailing_addressLine2", label: "Address Line 2" },
{ property: "districtId_mailing_city", label: "City" },
Expand Down Expand Up @@ -240,14 +240,15 @@ async function getAllDistrictMailing(req, res) {
districtContactResponse.data.content.forEach(appendMailingAddressDetailsAndRemoveAddresses);


const content = normalizeJsonObject(districtContactResponse.data.content, districtList, 'districtId', null, ['displayName', 'districtNumber']);
const contentWithDistrictLabels = normalizeJsonObject(districtContactResponse.data.content, districtList, 'districtId', null, ['displayName', 'districtNumber']);
let content= filterByField(contentWithDistrictLabels, 'districtId_districtNumber', ['']);
content.forEach((currentElement, index, array) => {
const rearrangedElement = rearrangeAndRelabelObjectProperties(currentElement, propertyOrder);
array[index] = rearrangedElement;
});
const contentByDistrict = sortJSONByDistrictNumber(content)
const validDistricts = filterRemoveByField(contentByDistrict,"District Number", ["098","102","103"])
res.json(validDistricts);

res.json(contentByDistrict);
//res.json(districtContactsReorderedAndRelabeled );
} catch (e) {
log.error("getData Error", e.response ? e.response.status : e.message);
Expand Down
2 changes: 0 additions & 2 deletions backend/src/routes/school-router.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ async function getAllSchools(req, res) {


if (await !schoolCache.has("openschoollist" + schoolCategory)) {
console.log("BUILDING CACHE FOR " + "openschoollist" + schoolCategory)
let currentDate = new Date().toISOString().substring(0, 19)
params = [

Expand Down Expand Up @@ -227,7 +226,6 @@ async function getAllSchools(req, res) {
);
});
} else {
console.log("USING CACHE" + " openschoollist" + schoolCategory)
const openSchoolList = await schoolCache.get("openschoollist" + schoolCategory);
res.json(openSchoolList);
}
Expand Down

0 comments on commit 1567572

Please sign in to comment.