sr-npm 3.1.28 → 3.1.30

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 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,11 +164,6 @@ async function retrieveJobsData() {
164
164
  return basicJob;
165
165
  });
166
166
 
167
- if (siteconfig.customFields==="true") {
168
-
169
- await populateCustomFieldsCollection(customFieldsLabels,templateType);
170
- await populateCustomValuesCollection(customFieldsValues);
171
- }
172
167
 
173
168
  // Sort jobs by title (ascending, case-insensitive, numeric-aware)
174
169
  jobsData.sort((a, b) => {
@@ -195,6 +190,7 @@ async function populateCustomFieldsCollection(customFields,templateType) {
195
190
  _id: ID,
196
191
  })
197
192
  }
193
+
198
194
  await wixData.bulkSave(COLLECTIONS.CUSTOM_FIELDS, fieldstoinsert);
199
195
  }
200
196
  async function populateCustomValuesCollection(customFieldsValues) {
@@ -424,9 +420,18 @@ async function syncJobsFast() {
424
420
 
425
421
  await clearCollections();
426
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
+ }
427
431
  console.log("saving jobs to CMS");
428
432
  await saveJobsToCMS(updatedJobs);
429
-
433
+ console.log("saved jobs to CMS successfully");
434
+
430
435
  if (siteconfig.customFields==="true") {
431
436
  await insertJobsReferencesToCustomValuesCollection();
432
437
  }
@@ -447,6 +452,7 @@ async function syncJobsFast() {
447
452
  }
448
453
 
449
454
  async function saveJobsToCMS(updatedJobs) {
455
+
450
456
  const chunkSize = 1000;
451
457
  let totalSaved = 0;
452
458
  const totalChunks = Math.ceil(updatedJobs.length / chunkSize);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sr-npm",
3
- "version": "3.1.28",
3
+ "version": "3.1.30",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -27,7 +27,7 @@ const {
27
27
 
28
28
  if(companysegmentValue===undefined || companysegmentValue.length===0) {
29
29
 
30
- _$w("#notifyMe").hide()
30
+ _$w("#notifyMeSection").collapse()
31
31
  console.log(`companysegmentValue is ${siteconfig.showNotifyMeForCompanySegment}, hiding notifyMe`);
32
32
  }
33
33