sr-npm 1.7.648 → 1.7.650
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 +17 -12
package/package.json
CHANGED
|
@@ -10,12 +10,12 @@ const countsByFieldId = new Map(); // fieldId -> {valueId: count} map of counts
|
|
|
10
10
|
let alljobs=[] // all jobs in the database
|
|
11
11
|
let allvaluesobjects=[] // all values in the database
|
|
12
12
|
let valueToJobs={} // valueId -> array of jobIds
|
|
13
|
-
let currentJobsIds=[] // current jobs that are displayed in the jobs repeater
|
|
13
|
+
//let currentJobsIds=[] // current jobs that are displayed in the jobs repeater
|
|
14
14
|
let currentJobs=[] // current jobs that are displayed in the jobs repeater
|
|
15
15
|
async function careersMultiBoxesPageOnReady(_$w) {
|
|
16
16
|
if(alljobs.length===0) {
|
|
17
17
|
alljobs=await getAllRecords(COLLECTIONS.JOBS);
|
|
18
|
-
|
|
18
|
+
// currentJobsIds=alljobs.map(job=>job._id);
|
|
19
19
|
currentJobs=alljobs;
|
|
20
20
|
console.log("alljobs: ",alljobs)
|
|
21
21
|
}
|
|
@@ -78,7 +78,7 @@ async function loadJobs(_$w) {
|
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
function updateTotalJobsCountText(_$w) {
|
|
81
|
-
_$w('#totalJobsCountText').text = `${
|
|
81
|
+
_$w('#totalJobsCountText').text = `${currentJobs.length} Jobs`;
|
|
82
82
|
|
|
83
83
|
}
|
|
84
84
|
|
|
@@ -234,16 +234,17 @@ async function loadJobs(_$w) {
|
|
|
234
234
|
async function applyJobFilters(_$w,filterByField) {
|
|
235
235
|
//let q = wixData.query(COLLECTIONS.JOBS)
|
|
236
236
|
console.log(alljobs)
|
|
237
|
-
let newFilteredJobs=[]
|
|
237
|
+
let newFilteredJobs=[];
|
|
238
|
+
let currentAllJobs=alljobs;
|
|
238
239
|
let addedJobsIds=[]
|
|
239
240
|
console.log("selectedByField: ",selectedByField)
|
|
240
241
|
|
|
241
242
|
// AND across categories, OR within each category
|
|
242
243
|
for (const [, values] of selectedByField.entries()) {
|
|
243
244
|
// console.log("values: ",values)
|
|
244
|
-
for(job of
|
|
245
|
+
for(job of currentAllJobs) {
|
|
245
246
|
//console.log("job: ",job)
|
|
246
|
-
|
|
247
|
+
console.log("job[filterByField]: ",job[filterByField])
|
|
247
248
|
// console.log("job[filterByField].some(value=>values.includes(value))) ",job[filterByField].some(value=>values.includes(value._id)))
|
|
248
249
|
if(job[filterByField].some(value=>values.includes(value._id))) {
|
|
249
250
|
// console.log("!alreadyAddedJobs.includes(job._id) ",!alreadyAddedJobs.includes(job._id))
|
|
@@ -253,7 +254,9 @@ async function loadJobs(_$w) {
|
|
|
253
254
|
}
|
|
254
255
|
}
|
|
255
256
|
}
|
|
256
|
-
|
|
257
|
+
addedJobsIds=[]
|
|
258
|
+
currentAllJobs=newFilteredJobs;
|
|
259
|
+
newFilteredJobs=[];
|
|
257
260
|
// if (values && values.length) {
|
|
258
261
|
|
|
259
262
|
// q = q.hasSome(filterByField, values);
|
|
@@ -261,10 +264,11 @@ async function loadJobs(_$w) {
|
|
|
261
264
|
// }
|
|
262
265
|
}
|
|
263
266
|
//console.log("alreadyAddedJobs: ",alreadyAddedJobs)
|
|
264
|
-
console.log("newFilteredJobs: ",
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
267
|
+
console.log("newFilteredJobs: ",currentAllJobs)
|
|
268
|
+
console.log("newFilteredJobs length: ",currentAllJobs.length)
|
|
269
|
+
currentJobs=currentAllJobs;
|
|
270
|
+
// currentJobsIds=addedJobsIds;
|
|
271
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOBS_REPEATER).data = currentAllJobs;
|
|
268
272
|
|
|
269
273
|
// await q.find()
|
|
270
274
|
// .then(async (res) => { _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOBS_REPEATER).data = res.items;
|
|
@@ -276,6 +280,7 @@ async function loadJobs(_$w) {
|
|
|
276
280
|
|
|
277
281
|
async function refreshFacetCounts(_$w) {
|
|
278
282
|
const fieldIds = Array.from(optionsByFieldId.keys());
|
|
283
|
+
const currentJobsIds=currentJobs.map(job=>job._id);
|
|
279
284
|
for (const fieldId of fieldIds) {
|
|
280
285
|
let currentoptions=optionsByFieldId.get(fieldId)
|
|
281
286
|
let counter=new Map();
|
|
@@ -326,7 +331,7 @@ async function refreshFacetCounts(_$w) {
|
|
|
326
331
|
res = await res.next();
|
|
327
332
|
newcurrentJobs.push(...res.items.map(job=>job._id));
|
|
328
333
|
}
|
|
329
|
-
|
|
334
|
+
currentJobs = newcurrentJobs;
|
|
330
335
|
}
|
|
331
336
|
|
|
332
337
|
module.exports = {
|