Bugfix data processor

This commit is contained in:
Starbeamrainbowlabs 2019-07-11 14:07:55 +01:00
parent 70da049d49
commit 4914d5a492

View file

@ -29,7 +29,7 @@ class DataProcessor {
input: fs.createReadStream(filename)
});
reader.on("line", this.process_line);
reader.on("line", this.process_line.bind(this));
reader.on("close", resolve);
})
@ -43,13 +43,14 @@ class DataProcessor {
longitude: parseFloat(parts[2]),
// For inserting into the database
data_rate: null,
code_rate: null
data_rate: null, code_rate: null, rssis: []
};
let log_message = `Processing reading with id ${reading.id}`;
if(!this.repo_reading.exists(reading.id)) {
// Since the reading doesn't exist in the database already, we should insert it now.
// We can deduce that it doesn't exist because no gateways picked up the message when it was transmitted - hence the IoT device was in a dead sopt at the time of transmission.
this.repo_reading.add(reading);
log_message += " no database entry detected, inserted new record";
}