sr-npm 1.7.591 → 1.7.593

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
@@ -171,9 +171,6 @@ async function saveJobsDataToCMS() {
171
171
  console.log(`✓ All chunks processed. Total jobs saved: ${totalSaved}/${jobsData.length}`);
172
172
  }
173
173
 
174
- async function insertValuesReference(jobId) {
175
- await wixData.insertReference(COLLECTIONS.JOBS, JOBS_COLLECTION_FIELDS.MULTI_REF_JOBS_CUSTOM_VALUES,jobId, jobToCustomValues[jobId]);
176
- }
177
174
  async function insertJobsReference(valueId) {
178
175
  await wixData.insertReference(COLLECTIONS.CUSTOM_VALUES, CUSTOM_VALUES_COLLECTION_FIELDS.MULTI_REF_JOBS_CUSTOM_VALUES,valueId, customValuesToJobs[valueId]);
179
176
  }
@@ -255,9 +252,6 @@ async function saveJobsDescriptionsAndLocationApplyUrlReferencesToCMS() {
255
252
  referFriendLink: referFriendLink,
256
253
  };
257
254
  await wixData.update(COLLECTIONS.JOBS, updatedJob);
258
- // if (siteconfig.customFields==="true") {
259
- // await insertValuesReference(job._id);
260
- // }
261
255
  return { success: true, jobId: job._id, title: job.title };
262
256
  } catch (error) {
263
257
  console.error(` ❌ Failed to update ${job.title} (${job._id}):`, error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sr-npm",
3
- "version": "1.7.591",
3
+ "version": "1.7.593",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -6,7 +6,8 @@ let valuesByFieldIdGlobal = null;
6
6
  const selectedByField = new Map(); // fieldId -> array of selected value IDs
7
7
  const optionsByFieldId = new Map(); // fieldId -> [{label, value}]
8
8
  const countsByFieldId = new Map();
9
-
9
+ let alljobs=[]
10
+ let valueToJobs=new Map();
10
11
  async function careersMultiBoxesPageOnReady(_$w) {
11
12
  await loadJobs(_$w);
12
13
  await loadFilters(_$w);
@@ -42,6 +43,19 @@ async function careersMultiBoxesPageOnReady(_$w) {
42
43
  });
43
44
  });
44
45
  updateSelectedValuesRepeater(_$w);
46
+ if(alljobs.length===0) {
47
+ alljobs=await getAllRecords(COLLECTIONS.JOBS);
48
+ }
49
+ if(valueToJobs.size===0) {
50
+ const allvaluesobjects=await getAllRecords(COLLECTIONS.CUSTOM_VALUES);
51
+ for (const value of allvaluesobjects) {
52
+ const result=await wixData.queryReferenced(COLLECTIONS.CUSTOM_VALUES, value, CUSTOM_VALUES_COLLECTION_FIELDS.MULTI_REF_JOBS_CUSTOM_VALUES)
53
+ valueToJobs.add(value._id, result.items);
54
+ }
55
+ }
56
+ console.log("valueToJobs: ",valueToJobs)
57
+ console.log("alljobs: ",alljobs)
58
+
45
59
  }
46
60
 
47
61
  async function loadJobs(_$w) {
@@ -187,6 +201,8 @@ async function loadJobs(_$w) {
187
201
  }
188
202
 
189
203
  function applyJobFilters(_$w,filterByField) {
204
+ console.log("applying job filters")
205
+ console.log("selectedByField: ",selectedByField)
190
206
  let q = wixData.query(COLLECTIONS.JOBS)
191
207
 
192
208
  // AND across categories, OR within each category
@@ -231,7 +247,7 @@ async function refreshFacetCounts(_$w) {
231
247
  const counts = new Map(); // valueId -> count
232
248
  for (const job of jobs) {
233
249
  const referencedfield= await wixData.queryReferenced(COLLECTIONS.JOBS, job, JOBS_COLLECTION_FIELDS.MULTI_REF_JOBS_CUSTOM_VALUES)
234
- console.log("referencedfield: ",referencedfield)
250
+ //console.log("referencedfield: ",referencedfield)
235
251
  const vals = referencedfield.items
236
252
  //const vals = job[JOB_VALUES_FIELD] || [];
237
253
  for (const val of vals) {