sr-npm 1.7.610 → 1.7.611

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sr-npm",
3
- "version": "1.7.610",
3
+ "version": "1.7.611",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -229,12 +229,11 @@ async function loadJobs(_$w) {
229
229
 
230
230
 
231
231
  async function refreshFacetCounts(_$w) {
232
- if (!valuesByFieldIdGlobal)
233
- {
234
- return;
235
- }
236
-
237
- const fieldIds = Array.from(optionsByFieldId.keys());
232
+ // if (!valuesByFieldIdGlobal)
233
+ // {
234
+ // return;
235
+ // }
236
+ const counts = new Map();
238
237
  for (const valueId of Object.keys(valueToJobs)) {
239
238
  for (const jobId of currentJobs) {
240
239
  if (valueToJobs[valueId].includes(jobId)) {
@@ -242,54 +241,66 @@ async function refreshFacetCounts(_$w) {
242
241
  }
243
242
  }
244
243
  }
244
+
245
+ // const fieldIds = Array.from(optionsByFieldId.keys());
246
+ // for (const valueId of Object.keys(valueToJobs)) {
247
+ // for (const jobId of currentJobs) {
248
+ // if (valueToJobs[valueId].includes(jobId)) {
249
+ // countsByFieldId.set(valueId, (countsByFieldId.get(valueId) || 0) + 1);
250
+ // }
251
+ // }
252
+ // }
245
253
 
246
254
 
247
- // Run per-field queries in parallel
248
- const tasks = fieldIds.map(async (fieldId) => {
249
- // Build query with selections from all other fields
250
- let q = wixData.query(COLLECTIONS.JOBS);
251
- for (const [fid, values] of selectedByField.entries()) {
252
- if (fid !== fieldId && values && values.length) {
253
- q = q.hasSome(JOBS_COLLECTION_FIELDS.MULTI_REF_JOBS_CUSTOM_VALUES, values);
254
- }
255
- }
255
+
256
+
257
+
258
+ // // Run per-field queries in parallel
259
+ // const tasks = fieldIds.map(async (fieldId) => {
260
+ // // Build query with selections from all other fields
261
+ // let q = wixData.query(COLLECTIONS.JOBS);
262
+ // for (const [fid, values] of selectedByField.entries()) {
263
+ // if (fid !== fieldId && values && values.length) {
264
+ // q = q.hasSome(JOBS_COLLECTION_FIELDS.MULTI_REF_JOBS_CUSTOM_VALUES, values);
265
+ // }
266
+ // }
256
267
 
257
- // Fetch all matching jobs (paged)
258
- const jobs = await findAll(q);
268
+ // // Fetch all matching jobs (paged)
269
+ // const jobs = await findAll(q);
259
270
 
260
271
 
261
- // Prepare a set of valid option IDs for this field
262
- const options = optionsByFieldId.get(fieldId) || [];
263
- const optionSet = new Set(options.map(o => o.value));
272
+ // // Prepare a set of valid option IDs for this field
273
+ // const options = optionsByFieldId.get(fieldId) || [];
274
+ // const optionSet = new Set(options.map(o => o.value));
264
275
 
265
- // Tally counts
266
- const counts = new Map(); // valueId -> count
267
- for (const job of jobs) {
268
- const referencedfield= await wixData.queryReferenced(COLLECTIONS.JOBS, job, JOBS_COLLECTION_FIELDS.MULTI_REF_JOBS_CUSTOM_VALUES)
269
- //console.log("referencedfield: ",referencedfield)
270
- const vals = referencedfield.items
271
- //const vals = job[JOB_VALUES_FIELD] || [];
272
- for (const val of vals) {
273
- if (optionSet.has(val._id)) {
274
- counts.set(val._id, (counts.get(val._id) || 0) + 1);
275
- }
276
- }
276
+ // // Tally counts
277
+ // const counts = new Map(); // valueId -> count
278
+ // for (const job of jobs) {
279
+ // const referencedfield= await wixData.queryReferenced(COLLECTIONS.JOBS, job, JOBS_COLLECTION_FIELDS.MULTI_REF_JOBS_CUSTOM_VALUES)
280
+ // //console.log("referencedfield: ",referencedfield)
281
+ // const vals = referencedfield.items
282
+ // //const vals = job[JOB_VALUES_FIELD] || [];
283
+ // for (const val of vals) {
284
+ // if (optionSet.has(val._id)) {
285
+ // counts.set(val._id, (counts.get(val._id) || 0) + 1);
286
+ // }
287
+ // }
277
288
 
278
- }
289
+ // }
279
290
 
280
- // Ensure every option has a count (zero if absent)
281
- for (const o of options) {
282
- if (!counts.has(o.value))
283
- {
284
- counts.set(o.value, 0);}
285
- }
291
+ // // Ensure every option has a count (zero if absent)
292
+ // for (const o of options) {
293
+ // if (!counts.has(o.value))
294
+ // {
295
+ // counts.set(o.value, 0);}
296
+ // }
286
297
 
287
- countsByFieldId.set(fieldId, counts);
288
- });
298
+ // countsByFieldId.set(fieldId, counts);
299
+ // });
289
300
 
290
- await Promise.all(tasks);
301
+ // await Promise.all(tasks);
291
302
 
292
- // After counts are ready, update all items currently rendered
303
+ // // After counts are ready, update all items currently rendered
293
304
  _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_REPEATER).forEachItem(($item, itemData) => {
294
305
  const query = ($item(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_LABEL).value || '').toLowerCase().trim();
295
306
  updateOptionsUI($item, itemData._id, query);
@@ -325,7 +336,7 @@ async function refreshFacetCounts(_$w) {
325
336
 
326
337
  async function updateCurrentJobs(res) {
327
338
  currentJobs = [];
328
- currentJobs.push(res.items.map(job=>job._id));
339
+ currentJobs.push(...res.items.map(job=>job._id));
329
340
  while (res.hasNext()) {
330
341
  res = await res.next();
331
342
  currentJobs.push(...res.items.map(job=>job._id));