Skip to content

Commit

Permalink
Fixed errors in tests! It was an issue with the way area was being ch…
Browse files Browse the repository at this point in the history
…ecked, now it converts strings to ints and functions
  • Loading branch information
SageMar committed Jan 24, 2025
1 parent 7c317f5 commit 4d85514
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/server/services/csvPipeline/uploadMeters.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const Meter = require('../../models/Meter');
const readCsv = require('../pipeline-in-progress/readCsv');
const Unit = require('../../models/Unit');
const { normalizeBoolean } = require('./validateCsvUploadParams');
const { type } = require('os');

/**
* Middleware that uploads meters via the pipeline. This should be the final stage of the CSV Pipeline.
Expand Down Expand Up @@ -47,8 +48,6 @@ async function uploadMeters(req, res, filepath, conn) {
// Validate min and max values
validateMinMaxValues(meter, i);



// First verify GPS is okay
// This assumes that the sixth column is the GPS as order is assumed for now in a GPS file.
const gpsInput = meter[6];
Expand All @@ -64,8 +63,8 @@ async function uploadMeters(req, res, filepath, conn) {
meter[6] = switchGPS(gpsInput);
}

// Verify area unit
const areaInput = meter[9];
// Verify area unit - have to parse float to ensure it can read in integer numbers like "33"
const areaInput = parseFloat(meter[9]);
if (areaInput) {
if (!isValidArea(areaInput)){
let msg = `For meter ${meter[0]} the area entry of ${areaInput} is invalid. Area must be a number greater than 0.`;
Expand Down

0 comments on commit 4d85514

Please sign in to comment.