sr-npm 1.7.601 → 1.7.603
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/backend/data.js +3 -3
- package/package.json +1 -1
- package/pages/careersMultiBoxesPage.js +19 -17
package/backend/data.js
CHANGED
|
@@ -187,8 +187,7 @@ async function populateCustomFieldsCollection(customFields) {
|
|
|
187
187
|
await wixData.bulkSave(COLLECTIONS.CUSTOM_FIELDS, fieldstoinsert);
|
|
188
188
|
}
|
|
189
189
|
async function populateCustomValuesCollection(customFieldsValues) {
|
|
190
|
-
valuesToinsert=[]
|
|
191
|
-
console.log("customValuesToJobs@@@@@@@@@@@@@: ",customValuesToJobs)
|
|
190
|
+
let valuesToinsert=[]
|
|
192
191
|
for (const fieldId of Object.keys(customFieldsValues)) {
|
|
193
192
|
const valuesMap = customFieldsValues[fieldId] || {};
|
|
194
193
|
for (const valueId of Object.keys(valuesMap)) {
|
|
@@ -199,8 +198,9 @@ async function populateCustomValuesCollection(customFieldsValues) {
|
|
|
199
198
|
totalJobs:customValuesToJobs[valueId].length,
|
|
200
199
|
jobIds:customValuesToJobs[valueId],
|
|
201
200
|
})
|
|
201
|
+
console.log("customValuesToJobs[valueId]",customValuesToJobs[valueId])
|
|
202
202
|
}
|
|
203
|
-
|
|
203
|
+
|
|
204
204
|
}
|
|
205
205
|
await wixData.bulkSave(COLLECTIONS.CUSTOM_VALUES, valuesToinsert);
|
|
206
206
|
}
|
package/package.json
CHANGED
|
@@ -6,7 +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
|
-
let
|
|
9
|
+
let alljobs=[]
|
|
10
|
+
let allvaluesobjects=[]
|
|
10
11
|
let valueToJobs={}
|
|
11
12
|
async function careersMultiBoxesPageOnReady(_$w) {
|
|
12
13
|
await loadJobs(_$w);
|
|
@@ -43,12 +44,12 @@ async function careersMultiBoxesPageOnReady(_$w) {
|
|
|
43
44
|
});
|
|
44
45
|
});
|
|
45
46
|
updateSelectedValuesRepeater(_$w);
|
|
46
|
-
if(
|
|
47
|
+
if(alljobs.length===0) {
|
|
47
48
|
let alljobsresult=await getAllRecords(COLLECTIONS.JOBS);
|
|
48
|
-
|
|
49
|
+
alljobs=alljobsresult.items;
|
|
49
50
|
}
|
|
50
51
|
if(valueToJobs.size===0) {
|
|
51
|
-
|
|
52
|
+
allvaluesobjects=await getAllRecords(COLLECTIONS.CUSTOM_VALUES);
|
|
52
53
|
console.log("allvaluesobjects@@@@@@@@@@@@@: ",allvaluesobjects)
|
|
53
54
|
for (const value of allvaluesobjects) {
|
|
54
55
|
console.log("value@@@@@@@@@@@@@: ",value)
|
|
@@ -56,7 +57,7 @@ async function careersMultiBoxesPageOnReady(_$w) {
|
|
|
56
57
|
}
|
|
57
58
|
}
|
|
58
59
|
console.log("valueToJobs: ",valueToJobs)
|
|
59
|
-
console.log("
|
|
60
|
+
console.log("alljobs: ",alljobs)
|
|
60
61
|
|
|
61
62
|
}
|
|
62
63
|
|
|
@@ -65,15 +66,16 @@ async function loadJobs(_$w) {
|
|
|
65
66
|
$item(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOBS_REPEATER_ITEM_TITLE).text = itemData.title || '';
|
|
66
67
|
$item(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOBS_REPEATER_ITEM_LOCATION).text=itemData.location.fullLocation
|
|
67
68
|
});
|
|
69
|
+
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOBS_REPEATER).data = alljobs;
|
|
68
70
|
|
|
69
|
-
return wixData.query(COLLECTIONS.JOBS)
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
71
|
+
// return wixData.query(COLLECTIONS.JOBS)
|
|
72
|
+
// .find()
|
|
73
|
+
// .then((res) => {
|
|
74
|
+
// _$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.JOBS_REPEATER).data = res.items;
|
|
75
|
+
// })
|
|
76
|
+
// .catch((err) => {
|
|
77
|
+
// console.error('Failed to load jobs:', err);
|
|
78
|
+
// });
|
|
77
79
|
}
|
|
78
80
|
|
|
79
81
|
async function loadFilters(_$w) {
|
|
@@ -83,8 +85,8 @@ async function loadJobs(_$w) {
|
|
|
83
85
|
_$w(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_REPEATER).data = fields;
|
|
84
86
|
|
|
85
87
|
// 2) Load all values once and group them by referenced field
|
|
86
|
-
const values = await getAllRecords(COLLECTIONS.CUSTOM_VALUES);
|
|
87
|
-
const valuesByFieldId = groupValuesByField(
|
|
88
|
+
//const values = await getAllRecords(COLLECTIONS.CUSTOM_VALUES);
|
|
89
|
+
const valuesByFieldId = groupValuesByField(allvaluesobjects, CUSTOM_VALUES_COLLECTION_FIELDS.CUSTOM_FIELD);
|
|
88
90
|
valuesByFieldIdGlobal = valuesByFieldId; // store globally
|
|
89
91
|
|
|
90
92
|
|
|
@@ -106,8 +108,8 @@ async function loadJobs(_$w) {
|
|
|
106
108
|
}));
|
|
107
109
|
optionsByFieldId.set(fieldId, originalOptions);
|
|
108
110
|
const counter={}
|
|
109
|
-
const allvalues=await getAllRecords(COLLECTIONS.CUSTOM_VALUES);
|
|
110
|
-
for (const val of
|
|
111
|
+
//const allvalues=await getAllRecords(COLLECTIONS.CUSTOM_VALUES);
|
|
112
|
+
for (const val of allvaluesobjects) {
|
|
111
113
|
counter[val.title]=val.totalJobs
|
|
112
114
|
}
|
|
113
115
|
|