sr-npm 1.7.48 → 1.7.50
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 +2 -5
- package/backend/queries.js +3 -4
- package/package.json +1 -1
package/backend/data.js
CHANGED
|
@@ -60,11 +60,9 @@ async function saveJobsDescriptionsAndLocationToCMS() {
|
|
|
60
60
|
|
|
61
61
|
try {
|
|
62
62
|
let jobsWithNoDescriptions = await getJobsWithNoDescriptions();
|
|
63
|
-
console.log('jobsWithNoDescriptions is ', jobsWithNoDescriptions);
|
|
64
63
|
let totalUpdated = 0;
|
|
65
64
|
let totalFailed = 0;
|
|
66
65
|
let totalProcessed = 0;
|
|
67
|
-
let pageNumber = 1;
|
|
68
66
|
|
|
69
67
|
console.log(
|
|
70
68
|
`Total jobs in database without descriptions: ${jobsWithNoDescriptions?.items?.length}`
|
|
@@ -80,7 +78,7 @@ async function saveJobsDescriptionsAndLocationToCMS() {
|
|
|
80
78
|
const pageChunks = Math.ceil(jobsWithNoDescriptions.items.length / API_CHUNK_SIZE);
|
|
81
79
|
|
|
82
80
|
await chunkedBulkOperation({
|
|
83
|
-
items:
|
|
81
|
+
items: jobsWithNoDescriptions.items,
|
|
84
82
|
chunkSize: API_CHUNK_SIZE,
|
|
85
83
|
processChunk: async (chunk, chunkNumber) => {
|
|
86
84
|
console.log(` Processing API chunk ${chunkNumber}/${pageChunks} (${chunk.length} jobs)`);
|
|
@@ -110,7 +108,7 @@ async function saveJobsDescriptionsAndLocationToCMS() {
|
|
|
110
108
|
console.log(
|
|
111
109
|
` API chunk ${chunkNumber} completed: ${chunkSuccesses} success, ${chunkFailures} failed`
|
|
112
110
|
);
|
|
113
|
-
if (chunkNumber * API_CHUNK_SIZE <
|
|
111
|
+
if (chunkNumber * API_CHUNK_SIZE < jobsWithNoDescriptions.items.length) {
|
|
114
112
|
console.log(' Waiting 2 seconds before next API chunk...');
|
|
115
113
|
await delay(2000);
|
|
116
114
|
}
|
|
@@ -234,7 +232,6 @@ async function referenceJobsToField({ referenceField, sourceCollection, jobField
|
|
|
234
232
|
}
|
|
235
233
|
|
|
236
234
|
function fetchJobLocation(jobDetails) {
|
|
237
|
-
console.log('jobDetails.location is ', jobDetails.location);
|
|
238
235
|
const isZeroLocation =
|
|
239
236
|
jobDetails.location.latitude === '0.0000' && jobDetails.location.longitude === '0.0000';
|
|
240
237
|
const jobLocation = {
|
package/backend/queries.js
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
const { COLLECTIONS,QUERY_MAX_LIMIT} = require('./consts');
|
|
2
1
|
const { items: wixData } = require('@wix/data');
|
|
3
2
|
|
|
4
3
|
async function getAllPositions() {
|
|
5
4
|
return wixData
|
|
6
|
-
.query(
|
|
7
|
-
.limit(
|
|
5
|
+
.query('Jobs1')
|
|
6
|
+
.limit(1000)
|
|
8
7
|
.find()
|
|
9
8
|
.then(result => result.items);
|
|
10
9
|
}
|
|
11
10
|
|
|
12
11
|
async function getPositionsByField(field, value) {
|
|
13
12
|
return wixData
|
|
14
|
-
.query(
|
|
13
|
+
.query('Jobs1')
|
|
15
14
|
.eq(field, value)
|
|
16
15
|
.find()
|
|
17
16
|
.then(result => result.items);
|