sr-npm 1.7.639 → 1.7.641

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.
@@ -54,6 +54,7 @@ const CITIES_COLLECTION_FIELDS = {
54
54
  LOCATION_ADDRESS: 'locationAddress',
55
55
  COUNT: 'count',
56
56
  COUNTRY: 'country',
57
+ JOB_IDS: 'jobIds',
57
58
  }
58
59
  const COLLECTIONS_FIELDS = {
59
60
  AMOUNT_OF_JOBS_PER_DEPARTMENT: [
@@ -67,6 +68,7 @@ const COLLECTIONS_FIELDS = {
67
68
  {key:'locationAddress', type: 'ADDRESS'},
68
69
  {key:'count', type: 'NUMBER'},
69
70
  {key:'country', type: 'TEXT'},
71
+ {key:'jobIds', type: 'ARRAY'},
70
72
  ],
71
73
  JOBS: [
72
74
  {key:'location', type: 'OBJECT'},
package/backend/data.js CHANGED
@@ -9,6 +9,7 @@ const { retrieveSecretVal, getTokenFromCMS } = require('./secretsData');
9
9
 
10
10
  //let jobToCustomValues = {}
11
11
  let customValuesToJobs = {}
12
+ let locationToJobs = {}
12
13
  let siteconfig;
13
14
  const EXCLUDED_CUSTOM_FIELDS = new Set(["Department"]);
14
15
 
@@ -64,7 +65,7 @@ function validateSingleDesiredBrand(desiredBrand) {
64
65
  }
65
66
  function getLocation(position,basicJob) {
66
67
 
67
- customValuesToJobs[basicJob.cityText] ? customValuesToJobs[basicJob.cityText].push(position.id) : customValuesToJobs[basicJob.cityText]=[position.id]
68
+ locationToJobs[basicJob.cityText] ? locationToJobs[basicJob.cityText].push(position.id) : locationToJobs[basicJob.cityText]=[position.id]
68
69
 
69
70
  }
70
71
  function getEmploymentType(position,customFieldsValues) {
@@ -315,7 +316,7 @@ async function aggregateJobsByFieldToCMS({ field, collection }) {
315
316
  console.log(`counting jobs per ${field}.`);
316
317
  let results = await getAllPositions();
317
318
  const { jobsPerField, cityLocations,citylocationAddress } = iterateOverAllJobs(results, field);
318
- const toSave = prepareToSaveArray(jobsPerField, cityLocations, field,citylocationAddress,customValuesToJobs);
319
+ const toSave = prepareToSaveArray(jobsPerField, cityLocations, field,citylocationAddress,locationToJobs);
319
320
  if (toSave.length === 0) {
320
321
  console.log('No jobs found.');
321
322
  return { success: true, message: 'No jobs to save.' };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sr-npm",
3
- "version": "1.7.639",
3
+ "version": "1.7.641",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -15,10 +15,11 @@ async function careersMultiBoxesPageOnReady(_$w) {
15
15
  if(alljobs.length===0) {
16
16
  alljobs=await getAllRecords(COLLECTIONS.JOBS);
17
17
  currentJobs=alljobs.map(job=>job._id);
18
+ console.log("alljobs: ",alljobs)
18
19
  }
19
20
  if(Object.keys(valueToJobs).length === 0){
20
21
  allvaluesobjects=await getAllRecords(COLLECTIONS.CUSTOM_VALUES);
21
-
22
+
22
23
  for (const value of allvaluesobjects) {
23
24
  valueToJobs[value._id]= value.jobIds;
24
25
  }
@@ -160,7 +161,7 @@ async function loadJobs(_$w) {
160
161
 
161
162
 
162
163
  async function getAllRecords(collectionId) {
163
- let q = wixData.query(collectionId);
164
+ let q = wixData.query(collectionId).include(JOBS_COLLECTION_FIELDS.MULTI_REF_JOBS_CUSTOM_VALUES)
164
165
 
165
166
 
166
167
  const items = [];