sr-npm 1.7.476 → 1.7.477
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/backend/data.js +4 -1
- package/backend/utils.js +2 -2
- package/package.json +1 -1
package/backend/data.js
CHANGED
|
@@ -8,6 +8,8 @@ const { getCompanyId, getSmartToken } = require('./secretsData');
|
|
|
8
8
|
|
|
9
9
|
function getBrand(customField) {
|
|
10
10
|
const brand = customField.find(field => field.fieldLabel === 'Brands')?.valueLabel;
|
|
11
|
+
console.log("brand: ", brand);
|
|
12
|
+
console.log("normalizeString(brand): ", normalizeString(brand));
|
|
11
13
|
return brand ? normalizeString(brand) : '';
|
|
12
14
|
}
|
|
13
15
|
|
|
@@ -310,7 +312,8 @@ async function aggregateJobs() {
|
|
|
310
312
|
console.log("Aggregating jobs");
|
|
311
313
|
await Promise.all([
|
|
312
314
|
aggregateJobsByFieldToCMS({ field: JOBS_COLLECTION_FIELDS.DEPARTMENT, collection: COLLECTIONS.AMOUNT_OF_JOBS_PER_DEPARTMENT }),
|
|
313
|
-
aggregateJobsByFieldToCMS({ field: JOBS_COLLECTION_FIELDS.CITY_TEXT, collection: COLLECTIONS.CITIES })
|
|
315
|
+
aggregateJobsByFieldToCMS({ field: JOBS_COLLECTION_FIELDS.CITY_TEXT, collection: COLLECTIONS.CITIES }),
|
|
316
|
+
aggregateJobsByFieldToCMS({ field: JOBS_COLLECTION_FIELDS.BRAND, collection: COLLECTIONS.BRANDS })
|
|
314
317
|
]);
|
|
315
318
|
console.log("finished aggregating jobs");
|
|
316
319
|
}
|
package/backend/utils.js
CHANGED
|
@@ -56,11 +56,11 @@ function prepareToSaveArray(jobsPerField, cityLocations, field,citylocationAddre
|
|
|
56
56
|
|
|
57
57
|
function normalizeString(str) {
|
|
58
58
|
if (!str) return str;
|
|
59
|
-
// Remove accents/diacritics, trim whitespace
|
|
59
|
+
// Remove accents/diacritics, keep spaces, trim whitespace
|
|
60
60
|
return str
|
|
61
61
|
.normalize('NFD')
|
|
62
62
|
.replace(/\p{Diacritic}/gu, '')
|
|
63
|
-
.replace(/[^A-Za-z0-9
|
|
63
|
+
.replace(/[^A-Za-z0-9-\s]/g, '');
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
|