sr-npm 1.7.651 → 1.7.652

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.651",
3
+ "version": "1.7.652",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -91,7 +91,10 @@ async function loadJobs(_$w) {
91
91
  console.log("cities: ",cities)
92
92
  // 2) Load all values once and group them by referenced field
93
93
 
94
- const valuesByFieldId = groupValuesByField(allvaluesobjects, CUSTOM_VALUES_COLLECTION_FIELDS.CUSTOM_FIELD);
94
+ let valuesByFieldId = groupValuesByField(allvaluesobjects, CUSTOM_VALUES_COLLECTION_FIELDS.CUSTOM_FIELD);
95
+ console.log("valuesByFieldId: ",valuesByFieldId)
96
+ valuesByFieldId["Location"]=cities
97
+ console.log("valuesByFieldId after addubg cities: ",valuesByFieldId)
95
98
  valuesByFieldIdGlobal = valuesByFieldId; // store globally
96
99
 
97
100
 
@@ -105,25 +108,38 @@ async function loadJobs(_$w) {
105
108
  // Set the filter label (category name)
106
109
  $item(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_LABEL).placeholder = itemData.title
107
110
 
108
- if(fieldId==="Location") {
109
- $item(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_REPEATER_ITEM_CHECKBOX).options = cities.map(city=>({
110
- label: city.city,
111
- value: city._id
112
- }));
113
- }
111
+ // if(fieldId==="Location") {
112
+ // $item(CAREERS_MULTI_BOXES_PAGE_CONSTS.FILTER_REPEATER_ITEM_CHECKBOX).options = cities.map(city=>({
113
+ // label: city.city,
114
+ // value: city._id
115
+ // }));
116
+ // }
114
117
 
115
118
  // Build CheckboxGroup options for this field
116
119
  const fieldValues = valuesByFieldId.get(fieldId) || [];
117
- const originalOptions = fieldValues.map(v => ({
120
+ console.log("fieldValues: ",fieldValues)
121
+ let originalOptions=[];
122
+ if(fieldId==="Location") {
123
+ originalOptions=fieldValues.map(city=>({
124
+ label: city.city,
125
+ value: city._id
126
+ }));
127
+ }
128
+ else{
129
+ originalOptions = fieldValues.map(v => ({
118
130
  label: v.title ,
119
131
  value: v._id
120
132
  }));
133
+ }
121
134
  optionsByFieldId.set(fieldId, originalOptions);
122
135
  const counter={}
123
136
 
124
137
  for (const val of allvaluesobjects) {
125
138
  counter[val.title]=val.totalJobs
126
139
  }
140
+ for(const city of cities) {
141
+ counter[city.city]=city.count
142
+ }
127
143
 
128
144
  countsByFieldId.set(fieldId, new Map(originalOptions.map(o => [o.value, counter[o.label]])));
129
145