sr-npm 1.7.592 → 1.7.593

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.592",
3
+ "version": "1.7.593",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -6,8 +6,8 @@ let valuesByFieldIdGlobal = null;
6
6
  const selectedByField = new Map(); // fieldId -> array of selected value IDs
7
7
  const optionsByFieldId = new Map(); // fieldId -> [{label, value}]
8
8
  const countsByFieldId = new Map();
9
- const alljobs=[]
10
-
9
+ let alljobs=[]
10
+ let valueToJobs=new Map();
11
11
  async function careersMultiBoxesPageOnReady(_$w) {
12
12
  await loadJobs(_$w);
13
13
  await loadFilters(_$w);
@@ -44,8 +44,18 @@ async function careersMultiBoxesPageOnReady(_$w) {
44
44
  });
45
45
  updateSelectedValuesRepeater(_$w);
46
46
  if(alljobs.length===0) {
47
- alljobs=await getAllRecords(COLLECTIONS.JOBS);
47
+ alljobs=await getAllRecords(COLLECTIONS.JOBS);
48
+ }
49
+ if(valueToJobs.size===0) {
50
+ const allvaluesobjects=await getAllRecords(COLLECTIONS.CUSTOM_VALUES);
51
+ for (const value of allvaluesobjects) {
52
+ const result=await wixData.queryReferenced(COLLECTIONS.CUSTOM_VALUES, value, CUSTOM_VALUES_COLLECTION_FIELDS.MULTI_REF_JOBS_CUSTOM_VALUES)
53
+ valueToJobs.add(value._id, result.items);
54
+ }
48
55
  }
56
+ console.log("valueToJobs: ",valueToJobs)
57
+ console.log("alljobs: ",alljobs)
58
+
49
59
  }
50
60
 
51
61
  async function loadJobs(_$w) {
@@ -191,6 +201,8 @@ async function loadJobs(_$w) {
191
201
  }
192
202
 
193
203
  function applyJobFilters(_$w,filterByField) {
204
+ console.log("applying job filters")
205
+ console.log("selectedByField: ",selectedByField)
194
206
  let q = wixData.query(COLLECTIONS.JOBS)
195
207
 
196
208
  // AND across categories, OR within each category
@@ -235,7 +247,7 @@ async function refreshFacetCounts(_$w) {
235
247
  const counts = new Map(); // valueId -> count
236
248
  for (const job of jobs) {
237
249
  const referencedfield= await wixData.queryReferenced(COLLECTIONS.JOBS, job, JOBS_COLLECTION_FIELDS.MULTI_REF_JOBS_CUSTOM_VALUES)
238
- console.log("referencedfield: ",referencedfield)
250
+ //console.log("referencedfield: ",referencedfield)
239
251
  const vals = referencedfield.items
240
252
  //const vals = job[JOB_VALUES_FIELD] || [];
241
253
  for (const val of vals) {