sr-npm 1.7.1021 → 1.7.1023

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.1021",
3
+ "version": "1.7.1023",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -58,6 +58,8 @@ async function clearAll(_$w) {
58
58
 
59
59
  async function handleUrlParams(_$w,urlParams) {
60
60
  try {
61
+ console.log("currentJobs: ",currentJobs);
62
+ console.log("currentJobs.length: ",currentJobs.length);
61
63
  let applyFiltering=false;
62
64
 
63
65
  //apply this first to determine all jobs
@@ -84,6 +86,9 @@ async function handleUrlParams(_$w,urlParams) {
84
86
  if(applyFiltering || keywordAllJobs) {
85
87
  await updateJobsAndNumbersAndFilters(_$w);
86
88
  }
89
+ console.log("currentJobs: ",currentJobs);
90
+ console.log("currentJobs.length: ",currentJobs.length);
91
+ console.log("Math.ceil(currentJobs.length/pagination.pageSize): ",Math.ceil(currentJobs.length/pagination.pageSize));
87
92
  if(urlParams.page) {
88
93
  if(Number.isNaN(Number(urlParams.page)) || Number(urlParams.page)<=1 || Number(urlParams.page)>Math.ceil(currentJobs.length/pagination.pageSize)) {
89
94
  console.warn("page number is invalid, removing page from url");
@@ -121,7 +126,9 @@ async function handleParams(_$w,param,values) {
121
126
  console.log("field: ",field);
122
127
  let existing = selectedByField.get(field._id) || [];
123
128
  for(const value of valuesAsArray) {
129
+ console.log("value: ",value);
124
130
  const decodedValue = decodeURIComponent(value);
131
+ console.log("decodedValue: ",decodedValue);
125
132
  const options=optionsByFieldId.get(field._id);
126
133
  console.log("options: ",options);
127
134
  const option=getCorrectOption(decodedValue,options);
@@ -138,8 +145,6 @@ async function handleParams(_$w,param,values) {
138
145
  }
139
146
  }
140
147
 
141
- console.log("existing after for loop: ",existing);
142
- console.log("selectedIndices after for loop: ",selectedIndices);
143
148
  selectedByField.set(field._id, existing);
144
149
  _$w(`#${FiltersIds[field.title]}CheckBox`).selectedIndices=selectedIndices;
145
150
  return applyFiltering;
@@ -175,7 +180,6 @@ async function handleParams(_$w,param,values) {
175
180
  $item(CAREERS_MULTI_BOXES_PAGE_CONSTS.SELECTED_VALUES_REPEATER_ITEM_LABEL).text = itemData.label || '';
176
181
  // Deselect this value from both the selected map and the multibox
177
182
  $item(CAREERS_MULTI_BOXES_PAGE_CONSTS.DESELECT_BUTTON_ID).onClick(async () => {
178
- console.log("deselect button clicked , itemData: ",itemData);
179
183
  const fieldId = itemData.fieldId;
180
184
  const valueId = itemData.valueId;
181
185
  dontUpdateThisCheckBox=fieldId;
@@ -2,6 +2,7 @@ const { items: wixData } = require('@wix/data');
2
2
  const { JOBS_COLLECTION_FIELDS,COLLECTIONS } = require('../backend/collectionConsts');
3
3
  const { CAREERS_MULTI_BOXES_PAGE_CONSTS,CATEGORY_CUSTOM_FIELD_ID_IN_CMS } = require('../backend/careersMultiBoxesPageIds');
4
4
  const { location } = require("@wix/site-location");
5
+ const { normalizeString } = require('../backend/utils');
5
6
 
6
7
  function groupValuesByField(values, refKey) {
7
8
  const map = new Map();
@@ -63,13 +64,14 @@ function groupValuesByField(values, refKey) {
63
64
  }
64
65
 
65
66
  function getCorrectOption(value,options) {
66
- const standardizedValue = value.toLowerCase().trim().replace(/[^a-z0-9]/gi, '');
67
- return options.find(option=>option.label.toLowerCase().trim().replace(/[^a-z0-9]/gi, '')===standardizedValue);
67
+ const standardizedValue = normalizeString(value.toLowerCase())
68
+ return options.find(option=>normalizeString(option.label.toLowerCase())===standardizedValue);
68
69
  }
69
70
 
70
71
  function getOptionIndexFromCheckBox(options,value) {
72
+ const normalizedValue=normalizeString(value.toLowerCase());
71
73
  for(let index=0;index<options.length;index++) {
72
- if(options[index].value===value) {
74
+ if(normalizeString(options[index].value.toLowerCase())===normalizedValue) {
73
75
  return index;
74
76
  }
75
77
  }