sr-npm 1.7.611 → 1.7.613
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 +32 -15
package/package.json
CHANGED
|
@@ -83,7 +83,7 @@ async function loadJobs(_$w) {
|
|
|
83
83
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_REPEATER).data = fields;
|
|
84
84
|
|
|
85
85
|
// 2) Load all values once and group them by referenced field
|
|
86
|
-
|
|
86
|
+
|
|
87
87
|
const valuesByFieldId = groupValuesByField(allvaluesobjects, CUSTOM_VALUES_COLLECTION_FIELDS.CUSTOM_FIELD);
|
|
88
88
|
valuesByFieldIdGlobal = valuesByFieldId; // store globally
|
|
89
89
|
|
|
@@ -106,7 +106,7 @@ async function loadJobs(_$w) {
|
|
|
106
106
|
}));
|
|
107
107
|
optionsByFieldId.set(fieldId, originalOptions);
|
|
108
108
|
const counter={}
|
|
109
|
-
|
|
109
|
+
|
|
110
110
|
for (const val of allvaluesobjects) {
|
|
111
111
|
counter[val.title]=val.totalJobs
|
|
112
112
|
}
|
|
@@ -219,8 +219,8 @@ async function loadJobs(_$w) {
|
|
|
219
219
|
}
|
|
220
220
|
|
|
221
221
|
q.find()
|
|
222
|
-
.then((res) => { _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOBS_REPEATER).data = res.items;
|
|
223
|
-
|
|
222
|
+
.then(async (res) => { _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOBS_REPEATER).data = res.items;
|
|
223
|
+
await updateCurrentJobs(res);
|
|
224
224
|
// currentJobs=res.items.map(job=>job._id);
|
|
225
225
|
console.log("updated currentJobs adfger fucniton: ",currentJobs)
|
|
226
226
|
})
|
|
@@ -233,20 +233,35 @@ async function refreshFacetCounts(_$w) {
|
|
|
233
233
|
// {
|
|
234
234
|
// return;
|
|
235
235
|
// }
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
const fieldIds = Array.from(optionsByFieldId.keys());
|
|
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
|
+
}
|
|
241
248
|
}
|
|
242
249
|
}
|
|
250
|
+
countsByFieldId.set(fieldId, counter);
|
|
243
251
|
}
|
|
244
|
-
|
|
245
|
-
// const
|
|
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
|
+
// }
|
|
246
261
|
// for (const valueId of Object.keys(valueToJobs)) {
|
|
247
262
|
// for (const jobId of currentJobs) {
|
|
248
263
|
// if (valueToJobs[valueId].includes(jobId)) {
|
|
249
|
-
//
|
|
264
|
+
// counter.set(valueId, (countsByFieldId.get(valueId) || 0) + 1);
|
|
250
265
|
// }
|
|
251
266
|
// }
|
|
252
267
|
// }
|
|
@@ -335,12 +350,14 @@ async function refreshFacetCounts(_$w) {
|
|
|
335
350
|
}
|
|
336
351
|
|
|
337
352
|
async function updateCurrentJobs(res) {
|
|
338
|
-
|
|
339
|
-
|
|
353
|
+
let newcurrentJobs = [];
|
|
354
|
+
newcurrentJobs.push(...res.items.map(job=>job._id));
|
|
340
355
|
while (res.hasNext()) {
|
|
341
356
|
res = await res.next();
|
|
342
|
-
|
|
357
|
+
newcurrentJobs.push(...res.items.map(job=>job._id));
|
|
343
358
|
}
|
|
359
|
+
console.log("newcurrentJobs inisde new function: ",newcurrentJobs)
|
|
360
|
+
currentJobs = newcurrentJobs;
|
|
344
361
|
console.log("updated currentJobs inisde new function: ",currentJobs)
|
|
345
362
|
}
|
|
346
363
|
|