sr-npm 1.7.736 → 1.7.738
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 +33 -10
package/package.json
CHANGED
|
@@ -360,9 +360,39 @@ function handlePageUrlParam() {
|
|
|
360
360
|
}
|
|
361
361
|
|
|
362
362
|
}
|
|
363
|
-
async function refreshFacetCounts(_$w,clearAll=false) {
|
|
363
|
+
async function refreshFacetCounts(_$w,clearAll=false,secondarySearch=false) {
|
|
364
|
+
console.log("refreshing facet counts");
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
secondarySearch? countJobsPerField(secondarySearchJobs):countJobsPerField(currentJobs);
|
|
368
|
+
// const fieldIds = Array.from(optionsByFieldId.keys());
|
|
369
|
+
// const currentJobsIds=currentJobs.map(job=>job._id);
|
|
370
|
+
// for (const fieldId of fieldIds) {
|
|
371
|
+
// let currentoptions=optionsByFieldId.get(fieldId)
|
|
372
|
+
// let counter=new Map();
|
|
373
|
+
// for(const option of currentoptions) {
|
|
374
|
+
// for (const jobId of currentJobsIds) {
|
|
375
|
+
// if (valueToJobs[option.value].includes(jobId)) {
|
|
376
|
+
// counter.set(option.value, (counter.get(option.value) || 0) + 1);
|
|
377
|
+
// }
|
|
378
|
+
// }
|
|
379
|
+
// }
|
|
380
|
+
// countsByFieldId.set(fieldId, counter);
|
|
381
|
+
// }
|
|
382
|
+
|
|
383
|
+
console.log("countsByFieldId: ", countsByFieldId);
|
|
384
|
+
|
|
385
|
+
for(const field of allfields) {
|
|
386
|
+
const query = (_$w(`#${FiltersIds[field.title]}input`).value || '').toLowerCase().trim();
|
|
387
|
+
clearAll? updateOptionsUI(_$w,field.title, field._id, '',true):updateOptionsUI(_$w,field.title, field._id, query);
|
|
388
|
+
// no search query
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
function countJobsPerField(jobs) {
|
|
364
394
|
const fieldIds = Array.from(optionsByFieldId.keys());
|
|
365
|
-
const currentJobsIds=
|
|
395
|
+
const currentJobsIds=jobs.map(job=>job._id);
|
|
366
396
|
for (const fieldId of fieldIds) {
|
|
367
397
|
let currentoptions=optionsByFieldId.get(fieldId)
|
|
368
398
|
let counter=new Map();
|
|
@@ -375,14 +405,7 @@ async function refreshFacetCounts(_$w,clearAll=false) {
|
|
|
375
405
|
}
|
|
376
406
|
countsByFieldId.set(fieldId, counter);
|
|
377
407
|
}
|
|
378
|
-
|
|
379
|
-
for(const field of allfields) {
|
|
380
|
-
const query = (_$w(`#${FiltersIds[field.title]}input`).value || '').toLowerCase().trim();
|
|
381
|
-
clearAll? updateOptionsUI(_$w,field.title, field._id, '',true):updateOptionsUI(_$w,field.title, field._id, query);
|
|
382
|
-
// no search query
|
|
383
|
-
}
|
|
384
408
|
}
|
|
385
|
-
|
|
386
409
|
|
|
387
410
|
|
|
388
411
|
function updateSelectedValuesRepeater(_$w) {
|
|
@@ -423,7 +446,7 @@ async function secondarySearch(_$w,query) {
|
|
|
423
446
|
}
|
|
424
447
|
handlePaginationButtons(_$w,true);
|
|
425
448
|
updateTotalJobsCountText(_$w,true);
|
|
426
|
-
await refreshFacetCounts(_$w);
|
|
449
|
+
await refreshFacetCounts(_$w,true);
|
|
427
450
|
return secondarySearchJobs;
|
|
428
451
|
}
|
|
429
452
|
async function bindSearchInput(_$w) {
|