Skip to content

Commit

Permalink
Fix data import
Browse files Browse the repository at this point in the history
  • Loading branch information
sheldhur committed Jan 7, 2018
1 parent 787bff4 commit 8823e98
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/workers/dataSetImport.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function saveDataSets(data) {
results.push({
dataSetId: id,
time: moment(row[0]).format(db.formatTime),
value: row[i].toFixed(5),
value: row[i] ? row[i].toFixed(5) : row[i],
format: data.format
});
});
Expand Down
8 changes: 3 additions & 5 deletions app/workers/stationImport.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,6 @@ export default function (dbSession, data) {

for (const stationKey in stationsData) {
const stationData = stationsData[stationKey];
process.send({ stationData });

const data = await saveStation(stationData, fileType);
process.send({ event: 'addStation', data: data.station });

Expand Down Expand Up @@ -111,7 +109,7 @@ function saveStationValues(data, files, stations, fileCurrent) {
if (i === 0) {
return moment(item).format(db.formatTime);
} else if (i >= 1 && i <= 3) {
return item.toFixed(5);
return item ? item.toFixed(5) : item;
}
});
stmt.run(...row, station.id, format, (error) => {
Expand Down Expand Up @@ -141,8 +139,8 @@ function saveStationValues(data, files, stations, fileCurrent) {

function convertToXY(values, reported = 'XYZF') {
if (!reported.startsWith('XY')) {
let X,
Y;
let X;
let Y;
if (reported.startsWith('HD')) {
const H = values[1];
const D = values[2];
Expand Down

0 comments on commit 8823e98

Please sign in to comment.