sr-npm 1.7.149 → 1.7.151

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.149",
3
+ "version": "1.7.151",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -265,11 +265,21 @@ async function handleDepartmentParam(_$w,department) {
265
265
  // Debug: Check dropdown options
266
266
 
267
267
  console.log("after refresh");
268
- const dropdownOptions = _$w('#dropdownDepartment').options;
268
+ let dropdownOptions = _$w('#dropdownDepartment').options;
269
269
  console.log("dropdown options:", dropdownOptions);
270
270
  const optionsFromCMS=await wixData.query("AmountOfJobsPerDepartment").find();
271
- if(dropdownOptions.length!==optionsFromCMS.items.length){
272
- throw new Error("dropdownOptions.length!==optionsFromCMS.items.length");
271
+ //+1 because of the "All" option
272
+
273
+ if(dropdownOptions.length!==optionsFromCMS.items.length+1){
274
+ dropdownOptions={
275
+ label: "All",
276
+ value: "RESET_ALL"
277
+ }
278
+ dropdownOptions.push(...optionsFromCMS.items.map(item=>({
279
+ label: item.title,
280
+ value: item.title
281
+ })));
282
+ console.warn("something is wrong with the dropdown options, fixing it");
273
283
  }
274
284
 
275
285