sr-npm 1.7.51 → 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 +5 -3
- package/backend/utils.js +3 -3
- package/package.json +1 -1
package/backend/data.js
CHANGED
|
@@ -151,8 +151,10 @@ async function aggregateJobsByFieldToCMS({ field, collection }) {
|
|
|
151
151
|
const cityLocations = {};
|
|
152
152
|
let results = await getAllPositions();
|
|
153
153
|
await iterateOverAllJobs(results, field, jobsPerField, cityLocations);
|
|
154
|
-
|
|
155
|
-
|
|
154
|
+
const toSave = prepateToSaveArray(jobsPerField, cityLocations, field);
|
|
155
|
+
console.log('jobsPerField is@@@@@@@@ ', jobsPerField);
|
|
156
|
+
console.log('cityLocations is@@@@@@@@ ', cityLocations);
|
|
157
|
+
console.log('toSave is@@@@@@@@ ', toSave);
|
|
156
158
|
if (toSave.length === 0) {
|
|
157
159
|
console.log('No jobs found.');
|
|
158
160
|
return { success: true, message: 'No jobs to save.' };
|
|
@@ -193,7 +195,7 @@ async function referenceJobsToField({ referenceField, sourceCollection, jobField
|
|
|
193
195
|
// Fetch all jobs
|
|
194
196
|
let jobsResults = await getAllPositions();
|
|
195
197
|
let jobsToUpdate = [];
|
|
196
|
-
console.log('jobsResults', jobsResults);
|
|
198
|
+
console.log('jobsResults@@@@@@@@ ', jobsResults);
|
|
197
199
|
|
|
198
200
|
for (const job of jobsResults) {
|
|
199
201
|
const refId = sourceMap[job[jobField]];
|
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,
|