|
@@ -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 += "<td>%s</td>" % (getDatePositionData(station, date, bookings))
|
|
|
text += "<tr><td style='text-align: left'>%s</td>%s</tr>" % (station, datestext)
|
|
|
|
|
|
- text += "</table> <div class='abbreviations'>"
|
|
|
+ text += "</table>"
|
|
|
+
|
|
|
+ text += "<div>"
|
|
|
+ if(training == 1):
|
|
|
+ text += "<span class='training'>Training </span>"
|
|
|
+ if(event == 1):
|
|
|
+ text += "<span class='event'>Event</span>"
|
|
|
+ text += "</div>"
|
|
|
+
|
|
|
+ text += "<div class='abbreviations'>"
|
|
|
|
|
|
i = 0
|
|
|
for key in sorted(abbreviations.keys()):
|
|
@@ -85,13 +94,6 @@ def maketable(stations, displaydates, bookings):
|
|
|
text += "</div><div class='abbreviations'>"
|
|
|
i = 0
|
|
|
text += "</div>"
|
|
|
-
|
|
|
- text += "<div style='clear:both'>"
|
|
|
- if(training == 1):
|
|
|
- text += "<span class='training'>Training </span>"
|
|
|
- if(event == 1):
|
|
|
- text += "<span class='event'>Event</span>"
|
|
|
- text += "</div>"
|
|
|
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()
|