sr-npm 1.7.167 → 1.7.169
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 -2
- package/backend/utils.js +5 -2
- package/package.json +1 -1
package/backend/data.js
CHANGED
|
@@ -316,8 +316,10 @@ async function createCollections() {
|
|
|
316
316
|
|
|
317
317
|
async function aggregateJobs() {
|
|
318
318
|
console.log("Aggregating jobs");
|
|
319
|
-
|
|
320
|
-
|
|
319
|
+
Promise.all([
|
|
320
|
+
aggregateJobsByFieldToCMS({ field: JOBS_COLLECTION_FIELDS.CITY_TEXT, collection: COLLECTIONS.CITIES }),
|
|
321
|
+
aggregateJobsByFieldToCMS({ field: JOBS_COLLECTION_FIELDS.DEPARTMENT, collection: COLLECTIONS.AMOUNT_OF_JOBS_PER_DEPARTMENT })
|
|
322
|
+
]);
|
|
321
323
|
console.log("finished aggregating jobs");
|
|
322
324
|
}
|
|
323
325
|
|
package/backend/utils.js
CHANGED
|
@@ -12,9 +12,12 @@ async function delay(ms) {
|
|
|
12
12
|
function countJobsPerGivenField(jobs, field,jobsPerField) {
|
|
13
13
|
for (const job of jobs) {
|
|
14
14
|
if (!job[field]) {
|
|
15
|
-
throw new Error(`Job ${job._id} has no ${field} field`);
|
|
15
|
+
//throw new Error(`Job ${job._id} has no ${field} field`);
|
|
16
|
+
//skip for now
|
|
17
|
+
}
|
|
18
|
+
else{
|
|
19
|
+
jobsPerField[job[field]] = (jobsPerField[job[field]] || 0) + 1;
|
|
16
20
|
}
|
|
17
|
-
jobsPerField[job[field]] = (jobsPerField[job[field]] || 0) + 1;
|
|
18
21
|
}
|
|
19
22
|
}
|
|
20
23
|
|