sr-npm 1.7.52 → 1.7.53
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 +1 -2
- package/backend/utils.js +3 -3
- package/package.json +1 -1
package/backend/data.js
CHANGED
|
@@ -151,10 +151,9 @@ async function aggregateJobsByFieldToCMS({ field, collection }) {
|
|
|
151
151
|
const cityLocations = {};
|
|
152
152
|
let results = await getAllPositions();
|
|
153
153
|
await iterateOverAllJobs(results, field, jobsPerField, cityLocations);
|
|
154
|
-
const toSave =
|
|
154
|
+
const toSave = prepateToSaveArray(jobsPerField, cityLocations, field);
|
|
155
155
|
console.log('jobsPerField is@@@@@@@@ ', jobsPerField);
|
|
156
156
|
console.log('cityLocations is@@@@@@@@ ', cityLocations);
|
|
157
|
-
prepateToSaveArray(jobsPerField, cityLocations, field, toSave);
|
|
158
157
|
console.log('toSave is@@@@@@@@ ', toSave);
|
|
159
158
|
if (toSave.length === 0) {
|
|
160
159
|
console.log('No jobs found.');
|
package/backend/utils.js
CHANGED
|
@@ -26,9 +26,9 @@ function fillCityLocation(jobs, cityLocations) {
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
function prepateToSaveArray(jobsPerField, cityLocations, field
|
|
29
|
+
function prepateToSaveArray(jobsPerField, cityLocations, field) {
|
|
30
30
|
if (field === 'cityText') {
|
|
31
|
-
|
|
31
|
+
return Object.entries(jobsPerField).map(([value, amount]) => {
|
|
32
32
|
const loc = cityLocations[value] || {};
|
|
33
33
|
value = normalizeCityName(value);
|
|
34
34
|
return {
|
|
@@ -48,7 +48,7 @@ function prepateToSaveArray(jobsPerField, cityLocations, field, toSave) {
|
|
|
48
48
|
};
|
|
49
49
|
});
|
|
50
50
|
} else {
|
|
51
|
-
|
|
51
|
+
return Object.entries(jobsPerField).map(([value, amount]) => ({
|
|
52
52
|
title: value,
|
|
53
53
|
_id: value.replace(/\s+/g, ''),
|
|
54
54
|
count: amount,
|