sr-npm 1.7.610 → 1.7.612
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 +1 -1
- package/pages/careersMultiBoxesPage.js +76 -48
package/package.json
CHANGED
|
@@ -229,67 +229,93 @@ async function loadJobs(_$w) {
|
|
|
229
229
|
|
|
230
230
|
|
|
231
231
|
async function refreshFacetCounts(_$w) {
|
|
232
|
-
if (!valuesByFieldIdGlobal)
|
|
233
|
-
{
|
|
234
|
-
|
|
235
|
-
}
|
|
232
|
+
// if (!valuesByFieldIdGlobal)
|
|
233
|
+
// {
|
|
234
|
+
// return;
|
|
235
|
+
// }
|
|
236
|
+
|
|
236
237
|
|
|
237
238
|
const fieldIds = Array.from(optionsByFieldId.keys());
|
|
238
|
-
for (const
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
239
|
+
for (const fieldId of fieldIds) {
|
|
240
|
+
let currentoptions=optionsByFieldId.get(fieldId)
|
|
241
|
+
console.log("currentoptions@@@@@@@@@@@@@: ",currentoptions)
|
|
242
|
+
let counter=new Map();
|
|
243
|
+
for(const option of currentoptions) {
|
|
244
|
+
for (const jobId of currentJobs) {
|
|
245
|
+
if (valueToJobs[option.value].includes(jobId)) {
|
|
246
|
+
counter.set(option.value, (countsByFieldId.get(option.value) || 0) + 1);
|
|
247
|
+
}
|
|
242
248
|
}
|
|
243
249
|
}
|
|
250
|
+
countsByFieldId.set(fieldId, counter);
|
|
244
251
|
}
|
|
245
252
|
|
|
253
|
+
// for (const valueId of Object.keys(valueToJobs)) {
|
|
254
|
+
// for (const jobId of currentJobs) {
|
|
255
|
+
// if (valueToJobs[valueId].includes(jobId)) {
|
|
256
|
+
// counter.set(valueId, (countsByFieldId.get(valueId) || 0) + 1);
|
|
257
|
+
// }
|
|
258
|
+
// }
|
|
259
|
+
// }
|
|
260
|
+
// }
|
|
261
|
+
// for (const valueId of Object.keys(valueToJobs)) {
|
|
262
|
+
// for (const jobId of currentJobs) {
|
|
263
|
+
// if (valueToJobs[valueId].includes(jobId)) {
|
|
264
|
+
// counter.set(valueId, (countsByFieldId.get(valueId) || 0) + 1);
|
|
265
|
+
// }
|
|
266
|
+
// }
|
|
267
|
+
// }
|
|
246
268
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
269
|
+
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
// // Run per-field queries in parallel
|
|
274
|
+
// const tasks = fieldIds.map(async (fieldId) => {
|
|
275
|
+
// // Build query with selections from all other fields
|
|
276
|
+
// let q = wixData.query(COLLECTIONS.JOBS);
|
|
277
|
+
// for (const [fid, values] of selectedByField.entries()) {
|
|
278
|
+
// if (fid !== fieldId && values && values.length) {
|
|
279
|
+
// q = q.hasSome(JOBS_COLLECTION_FIELDS.MULTI_REF_JOBS_CUSTOM_VALUES, values);
|
|
280
|
+
// }
|
|
281
|
+
// }
|
|
256
282
|
|
|
257
|
-
|
|
258
|
-
|
|
283
|
+
// // Fetch all matching jobs (paged)
|
|
284
|
+
// const jobs = await findAll(q);
|
|
259
285
|
|
|
260
286
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
287
|
+
// // Prepare a set of valid option IDs for this field
|
|
288
|
+
// const options = optionsByFieldId.get(fieldId) || [];
|
|
289
|
+
// const optionSet = new Set(options.map(o => o.value));
|
|
264
290
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
291
|
+
// // Tally counts
|
|
292
|
+
// const counts = new Map(); // valueId -> count
|
|
293
|
+
// for (const job of jobs) {
|
|
294
|
+
// const referencedfield= await wixData.queryReferenced(COLLECTIONS.JOBS, job, JOBS_COLLECTION_FIELDS.MULTI_REF_JOBS_CUSTOM_VALUES)
|
|
295
|
+
// //console.log("referencedfield: ",referencedfield)
|
|
296
|
+
// const vals = referencedfield.items
|
|
297
|
+
// //const vals = job[JOB_VALUES_FIELD] || [];
|
|
298
|
+
// for (const val of vals) {
|
|
299
|
+
// if (optionSet.has(val._id)) {
|
|
300
|
+
// counts.set(val._id, (counts.get(val._id) || 0) + 1);
|
|
301
|
+
// }
|
|
302
|
+
// }
|
|
277
303
|
|
|
278
|
-
|
|
304
|
+
// }
|
|
279
305
|
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
306
|
+
// // Ensure every option has a count (zero if absent)
|
|
307
|
+
// for (const o of options) {
|
|
308
|
+
// if (!counts.has(o.value))
|
|
309
|
+
// {
|
|
310
|
+
// counts.set(o.value, 0);}
|
|
311
|
+
// }
|
|
286
312
|
|
|
287
|
-
|
|
288
|
-
});
|
|
313
|
+
// countsByFieldId.set(fieldId, counts);
|
|
314
|
+
// });
|
|
289
315
|
|
|
290
|
-
await Promise.all(tasks);
|
|
316
|
+
// await Promise.all(tasks);
|
|
291
317
|
|
|
292
|
-
// After counts are ready, update all items currently rendered
|
|
318
|
+
// // After counts are ready, update all items currently rendered
|
|
293
319
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_REPEATER).forEachItem(($item, itemData) => {
|
|
294
320
|
const query = ($item(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_LABEL).value || '').toLowerCase().trim();
|
|
295
321
|
updateOptionsUI($item, itemData._id, query);
|
|
@@ -324,12 +350,14 @@ async function refreshFacetCounts(_$w) {
|
|
|
324
350
|
}
|
|
325
351
|
|
|
326
352
|
async function updateCurrentJobs(res) {
|
|
327
|
-
|
|
328
|
-
|
|
353
|
+
let newcurrentJobs = [];
|
|
354
|
+
newcurrentJobs.push(...res.items.map(job=>job._id));
|
|
329
355
|
while (res.hasNext()) {
|
|
330
356
|
res = await res.next();
|
|
331
|
-
|
|
357
|
+
newcurrentJobs.push(...res.items.map(job=>job._id));
|
|
332
358
|
}
|
|
359
|
+
console.log("newcurrentJobs inisde new function: ",newcurrentJobs)
|
|
360
|
+
currentJobs = newcurrentJobs;
|
|
333
361
|
console.log("updated currentJobs inisde new function: ",currentJobs)
|
|
334
362
|
}
|
|
335
363
|
|