sr-npm 1.7.52 → 1.7.54

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 CHANGED
@@ -6,7 +6,6 @@ const { getAllPositions } = require('./queries');
6
6
 
7
7
 
8
8
  async function saveJobsDataToCMS() {
9
- console.log('test!@##@@#@!#@!!#@@!#@!#@!@!!@#!@#!@!@!@#!@#@#!!@##!@#!@!@#@!#@!##!@');
10
9
  const positions = await fetchPositionsFromSRAPI();
11
10
  // bulk insert to jobs collection without descriptions first
12
11
  const jobsData = positions.content.map(position => {
@@ -28,6 +27,8 @@ async function saveJobsDataToCMS() {
28
27
  const chunkSize = 1000;
29
28
  let totalSaved = 0;
30
29
  const totalChunks = Math.ceil(jobsData.length / chunkSize);
30
+ console.log('jobsData is ', jobsData);
31
+ console.log('totalChunks is ', totalChunks);
31
32
 
32
33
  console.log(
33
34
  `Processing ${jobsData.length} jobs in ${totalChunks} chunks of max ${chunkSize} items each`
@@ -151,11 +152,7 @@ async function aggregateJobsByFieldToCMS({ field, collection }) {
151
152
  const cityLocations = {};
152
153
  let results = await getAllPositions();
153
154
  await iterateOverAllJobs(results, field, jobsPerField, cityLocations);
154
- const toSave = [];
155
- console.log('jobsPerField is@@@@@@@@ ', jobsPerField);
156
- console.log('cityLocations is@@@@@@@@ ', cityLocations);
157
- prepateToSaveArray(jobsPerField, cityLocations, field, toSave);
158
- console.log('toSave is@@@@@@@@ ', toSave);
155
+ const toSave = prepateToSaveArray(jobsPerField, cityLocations, field);
159
156
  if (toSave.length === 0) {
160
157
  console.log('No jobs found.');
161
158
  return { success: true, message: 'No jobs to save.' };
@@ -196,8 +193,7 @@ async function referenceJobsToField({ referenceField, sourceCollection, jobField
196
193
  // Fetch all jobs
197
194
  let jobsResults = await getAllPositions();
198
195
  let jobsToUpdate = [];
199
- console.log('jobsResults@@@@@@@@ ', jobsResults);
200
-
196
+
201
197
  for (const job of jobsResults) {
202
198
  const refId = sourceMap[job[jobField]];
203
199
  if (refId) {
package/backend/utils.js CHANGED
@@ -26,9 +26,9 @@ function fillCityLocation(jobs, cityLocations) {
26
26
  }
27
27
  }
28
28
 
29
- function prepateToSaveArray(jobsPerField, cityLocations, field, toSave) {
29
+ function prepateToSaveArray(jobsPerField, cityLocations, field) {
30
30
  if (field === 'cityText') {
31
- toSave = Object.entries(jobsPerField).map(([value, amount]) => {
31
+ return Object.entries(jobsPerField).map(([value, amount]) => {
32
32
  const loc = cityLocations[value] || {};
33
33
  value = normalizeCityName(value);
34
34
  return {
@@ -48,7 +48,7 @@ function prepateToSaveArray(jobsPerField, cityLocations, field, toSave) {
48
48
  };
49
49
  });
50
50
  } else {
51
- toSave = Object.entries(jobsPerField).map(([value, amount]) => ({
51
+ return Object.entries(jobsPerField).map(([value, amount]) => ({
52
52
  title: value,
53
53
  _id: value.replace(/\s+/g, ''),
54
54
  count: amount,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sr-npm",
3
- "version": "1.7.52",
3
+ "version": "1.7.54",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {