sr-npm 1.7.611 → 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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sr-npm",
3
- "version": "1.7.611",
3
+ "version": "1.7.612",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -233,20 +233,35 @@ async function refreshFacetCounts(_$w) {
233
233
  // {
234
234
  // return;
235
235
  // }
236
- const counts = new Map();
237
- for (const valueId of Object.keys(valueToJobs)) {
238
- for (const jobId of currentJobs) {
239
- if (valueToJobs[valueId].includes(jobId)) {
240
- countsByFieldId.set(valueId, (countsByFieldId.get(valueId) || 0) + 1);
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 fieldIds = Array.from(optionsByFieldId.keys());
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
- // countsByFieldId.set(valueId, (countsByFieldId.get(valueId) || 0) + 1);
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
- currentJobs = [];
339
- currentJobs.push(...res.items.map(job=>job._id));
353
+ let newcurrentJobs = [];
354
+ newcurrentJobs.push(...res.items.map(job=>job._id));
340
355
  while (res.hasNext()) {
341
356
  res = await res.next();
342
- currentJobs.push(...res.items.map(job=>job._id));
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