Skip to content

Commit

Permalink
Add some log messages
Browse files Browse the repository at this point in the history
  • Loading branch information
mpfeil committed Aug 14, 2023
1 parent 334c51c commit d511bad
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/api/lib/controllers/measurementsController.js
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,7 @@ const postNewMeasurements = async function postNewMeasurements (req, res) {
}

const measurements = await Measurement.decodeMeasurements(req.body, { contentType, sensors: box.sensors });
console.log("πŸš€ ~ file: measurementsController.js:424 ~ postNewMeasurements ~ measurements:", measurements)

Check failure on line 424 in packages/api/lib/controllers/measurementsController.js

View workflow job for this annotation

GitHub Actions / Lint code

Unexpected console statement

Check failure on line 424 in packages/api/lib/controllers/measurementsController.js

View workflow job for this annotation

GitHub Actions / Lint code

Strings must use singlequote

Check failure on line 424 in packages/api/lib/controllers/measurementsController.js

View workflow job for this annotation

GitHub Actions / Lint code

Missing semicolon
await box.saveMeasurementsArray(measurements);
res.send(201, 'Measurements saved in box');
} catch (err) {
Expand Down
4 changes: 3 additions & 1 deletion packages/models/src/measurement/decoding/csvHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ module.exports = {

if (message) {
const lines = message.split(/\r?\n/);
console.log("πŸš€ ~ file: csvHandler.js:18 ~ lines:", lines)

Check failure on line 18 in packages/models/src/measurement/decoding/csvHandler.js

View workflow job for this annotation

GitHub Actions / Lint code

Unexpected console statement

Check failure on line 18 in packages/models/src/measurement/decoding/csvHandler.js

View workflow job for this annotation

GitHub Actions / Lint code

Strings must use singlequote

Check failure on line 18 in packages/models/src/measurement/decoding/csvHandler.js

View workflow job for this annotation

GitHub Actions / Lint code

Missing semicolon
const splittedLines = lines.map(csvLineHandler);
console.log("πŸš€ ~ file: csvHandler.js:20 ~ splittedLines:", splittedLines)

Check failure on line 20 in packages/models/src/measurement/decoding/csvHandler.js

View workflow job for this annotation

GitHub Actions / Lint code

Unexpected console statement

Check failure on line 20 in packages/models/src/measurement/decoding/csvHandler.js

View workflow job for this annotation

GitHub Actions / Lint code

Strings must use singlequote

Check failure on line 20 in packages/models/src/measurement/decoding/csvHandler.js

View workflow job for this annotation

GitHub Actions / Lint code

Missing semicolon

// transform the splitted lines to an array containing measurements
const measurementsArray = [];
Expand All @@ -42,7 +44,7 @@ module.exports = {
}
}
}

console.log("πŸš€ ~ file: csvHandler.js:47 ~ transformAndValidateMeasurements:", measurementsArray)

Check failure on line 47 in packages/models/src/measurement/decoding/csvHandler.js

View workflow job for this annotation

GitHub Actions / Lint code

Unexpected console statement
return transformAndValidateMeasurements(measurementsArray);
}

Expand Down
5 changes: 4 additions & 1 deletion packages/models/src/measurement/decoding/validators.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ const transformAndValidateMeasurements = function transformAndValidateMeasuremen
}

try {
console.log("πŸš€ ~ file: validators.js:49 ~ validateMeasurementPrimitives:", elem)
validateMeasurementPrimitives(elem);
console.log("πŸš€ ~ file: validators.js:51 ~ validateMeasurementPrimitives: validated - ", elem)

if (typeof elem.createdAt === 'undefined') {
elem.createdAt = now;
Expand All @@ -71,9 +73,10 @@ const transformAndValidateMeasurements = function transformAndValidateMeasuremen
// finally attach a mongodb objectId
elem._id = mongoose.Types.ObjectId();
}

console.log("πŸš€ ~ file: validator.js:74 ~ transformAndValidateMeasurements: sort array now");
// sort measurements/locations by date
arr.sort((a, b) => a.createdAt.diff(b.createdAt));
console.log("πŸš€ ~ file: validator.js:77 ~ transformAndValidateMeasurements: array is sorted");

return resolve(arr);
});
Expand Down

0 comments on commit d511bad

Please sign in to comment.