add a json dumper for the server

This commit is contained in:
Sven Czarnian
2021-11-11 11:03:03 +01:00
والد 3d87c3918b
کامیت 19a9947d3d

مشاهده پرونده

@@ -1,5 +1,6 @@
#!/usr/bin/env python
import json
import pytz
import sys
@@ -83,6 +84,13 @@ class Inbound:
self.PlannedRunway = runway
break
def toJSON(self):
pta = str(self.PlannedArrivalTime)
delimiter = pta.find('.')
if -1 == delimiter:
delimiter = pta.find('+')
return json.dumps({ 'callsign' : self.Callsign, 'runway' : self.PlannedRunway.Name, 'pta' : pta[0:delimiter] }, ensure_ascii=True)
def arrivalEstimation(self, runway : Runway, star : ArrivalRoute, weather : WeatherModel):
# calculate remaining trackmiles
trackmiles = self.Report.distanceToIAF