Skip to content
Snippets Groups Projects
Commit cf82bed4 authored by Sara Savanovic Djordjevic's avatar Sara Savanovic Djordjevic
Browse files

update: more error handling

parent 17c3992d
No related branches found
No related tags found
1 merge request!13Clhp map
......@@ -23,7 +23,9 @@ class Measurement {
try {
return Measurement(
measurementID: json['MeasurementID'] ?? 0,
timeMeasured: DateTime.parse(json['TimeMeasured']),
timeMeasured: json['TimeMeasured'] != null
? DateTime.parse(json['TimeMeasured'])
: DateTime(0),
sensor: Sensor.fromJson(json['Sensor']),
bodyOfWater: json['BodyOfWater'] != null ? json['BodyOfWater'].toString() : 'nil',
center: LatLng(
......@@ -148,6 +150,14 @@ class Sensor {
factory Sensor.fromJson(Map<String, dynamic> json) {
try {
if (json == null) {
return Sensor(
sensorID: -1,
sensorType: 'Weather data only',
active: false
);
}
return Sensor(
sensorID: json['SensorID'] ?? 0,
sensorType: json['SensorType'] ?? 'nil',
......
import json
from datetime import datetime
from server.consts import LAKE_RELATIONS_PATH
from server.ModelFromNVE.icemodellingscripts.getIceThicknessLakes import get_raw_dates, ice_prognosis_raw_data
......@@ -74,7 +75,7 @@ def get_measurements(self, cursor, lake_name):
remaining_sub_divs = fillRemainingSubdivisions(lake_name, sub_div_ids)
measurement_data[-1] = {
'MeasurementID': -1,
'TimeMeasured': None,
'TimeMeasured': datetime.now(),
'CenterLat': None,
'CenterLon': None,
'Sensor': None,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment