diff --git a/vatsched.py b/vatsched.py
index 8d31b16..29ac15b 100644
--- a/vatsched.py
+++ b/vatsched.py
@@ -11,7 +11,7 @@ def EveryXDaysFromStartdate(startdate, x, numberofdates = 1):
days = []
while (len(days) < numberofdates):
startdate += timedelta(days=x)
- if(datetime.today() <= startdate):
+ if(datetime.today().date() <= startdate.date()):
days.append(startdate)
return days
@@ -75,7 +75,16 @@ def maketable(stations, displaydates, bookings):
datestext += "
"
+ text += ""
+
+ text += "
"
+ if(training == 1):
+ text += "Training "
+ if(event == 1):
+ text += "Event"
+ text += "
"
+
+ text += "
"
i = 0
for key in sorted(abbreviations.keys()):
@@ -85,13 +94,6 @@ def maketable(stations, displaydates, bookings):
text += "
"
i = 0
text += "
"
-
- text += "
"
- if(training == 1):
- text += "Training "
- if(event == 1):
- text += "Event"
- text += "
"
return text
@@ -100,7 +102,8 @@ def createImage(displaydates, stations, filename):
training = event = 0
abbreviations = {}
- rawdata = fetchData(displaydates[0], displaydates[-1])
+ rawdata = fetchData(displaydates[0] - timedelta(1), displaydates[-1] + timedelta(1))
+
relbookings = {}
for station in stations:
relbookings[station] = []
@@ -116,6 +119,8 @@ def createImage(displaydates, stations, filename):
'event': datum['event']
})
+ print(relbookings)
+
text = maketable(stations, displaydates, relbookings)
directory, dontcare = os.path.split(__file__)
@@ -128,5 +133,6 @@ def createImage(displaydates, stations, filename):
def fetchData(startdate = datetime.today(), enddate = (datetime.today() + timedelta(1))):
url = 'https://vatsim-germany.org/api/booking/atc/daterange/%s/%s' % (startdate.strftime("%d.%m.%Y"), enddate.strftime("%d.%m.%Y"))
+ print(url)
r = requests.get(url=url,headers={'X-Requested-With': 'XMLHttpRequest'})
return r.json()
\ No newline at end of file