diff --git a/lib/transport_helper.dart b/lib/transport_helper.dart index ca84870..785d6f7 100644 --- a/lib/transport_helper.dart +++ b/lib/transport_helper.dart @@ -823,31 +823,25 @@ class Departure { departureTime: map["departuretime"] as DateTime, ); } + factory Departure.fromJson(Map json) { Vehicle vehicle = Vehicle.fromJson(json["Product"][0]); - // try { vehicle.dbInsert(); - // } catch (e) { - // vehicle.dbUpdate(); - // } Station station = Station( id: json["stopid"], name: json["stop"], transportLines: [], ); - // try { station.dbInsert(); - // } catch (e) { - // station.dbUpdate(); - // } + DateTime? arrDateTime; - DateTime? depDateTime; String? arrivalDate = json["arrDate"]; String? arrivalTime = json["arrTime"]; if (arrivalDate != null && arrivalTime != null) { arrDateTime = DateTime.parse('${arrivalDate}T$arrivalTime'); } + DateTime? depDateTime; String? departureDate = json["depDate"] ?? json["date"]; String? departureTime = json["depTime"] ?? json["time"]; if (departureDate != null && departureTime != null) { @@ -985,4 +979,4 @@ enum VehicleType { subway, regionalTrain, PLACEHOLDER, -} \ No newline at end of file +}