sr-npm 1.7.1325 → 1.7.1327
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 +14 -12
- package/package.json +1 -1
- package/pages/positionPage.js +1 -1
package/backend/data.js
CHANGED
|
@@ -16,6 +16,8 @@ const { chunkedBulkOperation,
|
|
|
16
16
|
let customValuesToJobs = {}
|
|
17
17
|
let locationToJobs = {}
|
|
18
18
|
let siteconfig;
|
|
19
|
+
let customFieldsLabels = {}
|
|
20
|
+
let customFieldsValues = {}
|
|
19
21
|
const EXCLUDED_CUSTOM_FIELDS = new Set(["Department","Country"]);
|
|
20
22
|
|
|
21
23
|
function getBrand(customField) {
|
|
@@ -117,8 +119,6 @@ function getCustomFieldsAndValuesFromPosition(position, customFieldsLabels, cust
|
|
|
117
119
|
async function retrieveJobsData() {
|
|
118
120
|
const positions = await fetchPositionsFromSRAPI();
|
|
119
121
|
const sourcePositions = await filterBasedOnBrand(positions);
|
|
120
|
-
const customFieldsLabels = {}
|
|
121
|
-
const customFieldsValues = {}
|
|
122
122
|
|
|
123
123
|
const { templateType } = await getApiKeys();
|
|
124
124
|
if(siteconfig===undefined) {
|
|
@@ -164,12 +164,6 @@ async function retrieveJobsData() {
|
|
|
164
164
|
return basicJob;
|
|
165
165
|
});
|
|
166
166
|
|
|
167
|
-
if (siteconfig.customFields==="true") {
|
|
168
|
-
console.log("populating custom fields and values collections");
|
|
169
|
-
await populateCustomFieldsCollection(customFieldsLabels,templateType);
|
|
170
|
-
await populateCustomValuesCollection(customFieldsValues);
|
|
171
|
-
console.log("populated custom fields and values collections successfully");
|
|
172
|
-
}
|
|
173
167
|
|
|
174
168
|
// Sort jobs by title (ascending, case-insensitive, numeric-aware)
|
|
175
169
|
jobsData.sort((a, b) => {
|
|
@@ -196,8 +190,7 @@ async function populateCustomFieldsCollection(customFields,templateType) {
|
|
|
196
190
|
_id: ID,
|
|
197
191
|
})
|
|
198
192
|
}
|
|
199
|
-
|
|
200
|
-
console.log("fieldstoinsert: cusotmfields ", fieldstoinsert);
|
|
193
|
+
|
|
201
194
|
await wixData.bulkSave(COLLECTIONS.CUSTOM_FIELDS, fieldstoinsert);
|
|
202
195
|
}
|
|
203
196
|
async function populateCustomValuesCollection(customFieldsValues) {
|
|
@@ -216,7 +209,6 @@ async function populateCustomValuesCollection(customFieldsValues) {
|
|
|
216
209
|
})
|
|
217
210
|
}
|
|
218
211
|
}
|
|
219
|
-
console.log("valuesToinsert: customFieldsValues ", valuesToinsert);
|
|
220
212
|
await wixData.bulkSave(COLLECTIONS.CUSTOM_VALUES, valuesToinsert);
|
|
221
213
|
}
|
|
222
214
|
|
|
@@ -428,9 +420,18 @@ async function syncJobsFast() {
|
|
|
428
420
|
|
|
429
421
|
await clearCollections();
|
|
430
422
|
const updatedJobs=status.updatedJobs;
|
|
423
|
+
|
|
424
|
+
if (siteconfig.customFields==="true") {
|
|
425
|
+
const { templateType } = await getApiKeys();
|
|
426
|
+
console.log("populating custom fields and values collections");
|
|
427
|
+
await populateCustomFieldsCollection(customFieldsLabels,templateType);
|
|
428
|
+
await populateCustomValuesCollection(customFieldsValues);
|
|
429
|
+
console.log("populated custom fields and values collections successfully");
|
|
430
|
+
}
|
|
431
431
|
console.log("saving jobs to CMS");
|
|
432
432
|
await saveJobsToCMS(updatedJobs);
|
|
433
|
-
|
|
433
|
+
console.log("saved jobs to CMS successfully");
|
|
434
|
+
|
|
434
435
|
if (siteconfig.customFields==="true") {
|
|
435
436
|
await insertJobsReferencesToCustomValuesCollection();
|
|
436
437
|
}
|
|
@@ -451,6 +452,7 @@ async function syncJobsFast() {
|
|
|
451
452
|
}
|
|
452
453
|
|
|
453
454
|
async function saveJobsToCMS(updatedJobs) {
|
|
455
|
+
|
|
454
456
|
const chunkSize = 1000;
|
|
455
457
|
let totalSaved = 0;
|
|
456
458
|
const totalChunks = Math.ceil(updatedJobs.length / chunkSize);
|
package/package.json
CHANGED
package/pages/positionPage.js
CHANGED
|
@@ -27,7 +27,7 @@ const {
|
|
|
27
27
|
|
|
28
28
|
if(companysegmentValue===undefined || companysegmentValue.length===0) {
|
|
29
29
|
|
|
30
|
-
_$w("#
|
|
30
|
+
_$w("#notifyMeSection").hide()
|
|
31
31
|
console.log(`companysegmentValue is ${siteconfig.showNotifyMeForCompanySegment}, hiding notifyMe`);
|
|
32
32
|
}
|
|
33
33
|
|