mirror of https://github.com/stijndcl/didier
Did some small formatting in les.py
parent
245a900c87
commit
08fe799a30
|
@ -93,7 +93,9 @@ def getCourses(schedule, day, week):
|
||||||
|
|
||||||
for course in schedule:
|
for course in schedule:
|
||||||
for slot in course["slots"]:
|
for slot in course["slots"]:
|
||||||
if day in slot["time"]:
|
if day not in slot["time"]:
|
||||||
|
continue
|
||||||
|
|
||||||
# Basic dict containing the course name & the class' time slot
|
# Basic dict containing the course name & the class' time slot
|
||||||
classDic = {"course": course["course"], "slot": slot}
|
classDic = {"course": course["course"], "slot": slot}
|
||||||
|
|
||||||
|
@ -245,18 +247,30 @@ def getLocation(slot):
|
||||||
if "canceled" in slot:
|
if "canceled" in slot:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# TODO fix this because it's ugly
|
|
||||||
if "online" in slot:
|
if "online" in slot:
|
||||||
return "online @ **[{}]({})**".format(slot["online"],
|
# NOTE maybe this should be moved to a more general config area instead
|
||||||
slot["zoom"] if slot["online"] == "ZOOM" else slot["msteams"] if slot[
|
platforms = {
|
||||||
"online"] == "MS Teams" else
|
"ZOOM": slot["zoom"],
|
||||||
slot["bongo"])
|
"MS Teams": slot["msteams"],
|
||||||
|
}
|
||||||
|
|
||||||
|
return "online @ **[{}]({})**".format(
|
||||||
|
slot["online"],
|
||||||
|
platforms.get(slot["online"], slot["bongo"]
|
||||||
|
)
|
||||||
|
|
||||||
# Check for courses in multiple locations
|
# Check for courses in multiple locations
|
||||||
if "locations" in slot:
|
if "locations" in slot:
|
||||||
# Language - 'en' for the last one
|
# Language - 'en' for the last one
|
||||||
return ", ".join(getLocation(location) for location in slot["locations"][:-1]) \
|
return sum(
|
||||||
+ " en " + getLocation(slot["locations"][-1])
|
", ".join(
|
||||||
|
getLocation(location)
|
||||||
|
for location in slot["locations"][:-1]
|
||||||
|
),
|
||||||
|
" en ",
|
||||||
|
getLocation(slot["locations"][-1])
|
||||||
|
)
|
||||||
|
|
||||||
return "in {} {} {}".format(slot["campus"], slot["building"], slot["room"])
|
return "in {} {} {}".format(slot["campus"], slot["building"], slot["room"])
|
||||||
|
|
||||||
|
|
||||||
|
@ -273,9 +287,8 @@ def getTitle(day, dayDT, week):
|
||||||
# week += 1
|
# week += 1
|
||||||
|
|
||||||
day = day[0].upper() + day[1:].lower()
|
day = day[0].upper() + day[1:].lower()
|
||||||
|
titleString = f"{day} {dayDT.day:02}/{dayDT.month:02}/{dayDT.year}"
|
||||||
|
|
||||||
titleString = "{} {}/{}/{}".format(day, stringFormatters.leadingZero(dayDT.day),
|
|
||||||
stringFormatters.leadingZero(dayDT.month), dayDT.year)
|
|
||||||
return titleString, week
|
return titleString, week
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue