mirror of https://github.com/stijndcl/didier
Update schedules & add some QOL & small fixes
parent
9a2313d376
commit
7bac54599a
|
@ -73,7 +73,7 @@ class Timeslot:
|
||||||
return f"[{self.online_platform.value.get('name')}]({self.online_link})"
|
return f"[{self.online_platform.value.get('name')}]({self.online_link})"
|
||||||
|
|
||||||
def _get_location_str(self, offline_prefix="in", online_prefix="**online** @") -> str:
|
def _get_location_str(self, offline_prefix="in", online_prefix="**online** @") -> str:
|
||||||
return f"{offline_prefix} {self.location}" if self.location is not None \
|
return f"{offline_prefix} **{self.location}**" if self.location is not None \
|
||||||
else f"{online_prefix} **{self.get_link_str()}**"
|
else f"{online_prefix} **{self.get_link_str()}**"
|
||||||
|
|
||||||
def get_special_fmt_str(self) -> Optional[str]:
|
def get_special_fmt_str(self) -> Optional[str]:
|
||||||
|
@ -86,7 +86,7 @@ class Timeslot:
|
||||||
|
|
||||||
# Something else is wrong
|
# Something else is wrong
|
||||||
return f"⚠️ {self.course} gaat vandaag door van **{timeFromInt(self.start_time)}** tot " \
|
return f"⚠️ {self.course} gaat vandaag door van **{timeFromInt(self.start_time)}** tot " \
|
||||||
f"**{timeFromInt(self.end_time)}** **{self._get_location_str(online_prefix='op')}**"
|
f"**{timeFromInt(self.end_time)}** {self._get_location_str(online_prefix='op')}"
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def from_slot_dict(slot_dict: Dict, course_dict: Dict, current_week: int):
|
def from_slot_dict(slot_dict: Dict, course_dict: Dict, current_week: int):
|
||||||
|
@ -95,14 +95,15 @@ class Timeslot:
|
||||||
"""
|
"""
|
||||||
special = False
|
special = False
|
||||||
|
|
||||||
if "weeks" in slot_dict and str(current_week) in slot_dict["weeks"]:
|
week = find_week(str(current_week), slot_dict)
|
||||||
|
if week is not None:
|
||||||
# If at least one thing was changed, this slot requires extra attention
|
# If at least one thing was changed, this slot requires extra attention
|
||||||
special = True
|
special = True
|
||||||
# Overwrite the normal data with the customized entries
|
# Overwrite the normal data with the customized entries
|
||||||
slot_dict.update(slot_dict["weeks"][str(current_week)])
|
slot_dict.update(week)
|
||||||
|
|
||||||
# Only happens online, not on-campus
|
# Only happens online, not on-campus
|
||||||
online_only = slot_dict["weeks"][str(current_week)].get("online_only", False)
|
online_only = week.get("online_only", False)
|
||||||
if online_only:
|
if online_only:
|
||||||
slot_dict.pop("location")
|
slot_dict.pop("location")
|
||||||
|
|
||||||
|
@ -406,7 +407,9 @@ class ScheduleEmbed(LesEmbed):
|
||||||
if not has_link:
|
if not has_link:
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
return "\n".join(list(f"{entry.course}: **{entry.get_link_str()}**" for entry in has_link))
|
# Store in a set first to remove duplicates
|
||||||
|
entries = list(set(f"{entry.course}: **{entry.get_link_str()}**" for entry in has_link))
|
||||||
|
return "\n".join(list(sorted(entries)))
|
||||||
|
|
||||||
|
|
||||||
def find_minor(client: commands.Bot, userid: int) -> Tuple[Optional[int]]:
|
def find_minor(client: commands.Bot, userid: int) -> Tuple[Optional[int]]:
|
||||||
|
@ -420,3 +423,20 @@ def find_minor(client: commands.Bot, userid: int) -> Tuple[Optional[int]]:
|
||||||
return role.id,
|
return role.id,
|
||||||
|
|
||||||
return None,
|
return None,
|
||||||
|
|
||||||
|
|
||||||
|
def find_week(week: str, slot_dict: Dict) -> Optional[Dict]:
|
||||||
|
"""Find a week in a slot_dict"""
|
||||||
|
if "weeks" not in slot_dict:
|
||||||
|
return None
|
||||||
|
|
||||||
|
# Split all entries based on commas
|
||||||
|
# to allow grouping weeks together
|
||||||
|
for w in slot_dict["weeks"]:
|
||||||
|
weeks = w.split(",")
|
||||||
|
|
||||||
|
if week in weeks:
|
||||||
|
return slot_dict["weeks"][w]
|
||||||
|
|
||||||
|
# Week was not in any of the lists
|
||||||
|
return None
|
||||||
|
|
|
@ -26,8 +26,12 @@
|
||||||
"weeks": {
|
"weeks": {
|
||||||
"6": {
|
"6": {
|
||||||
"canceled": true
|
"canceled": true
|
||||||
|
},
|
||||||
|
"10,11,12": {
|
||||||
|
"online_only": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"online": "zoom",
|
||||||
"location": {
|
"location": {
|
||||||
"campus": "Sterre",
|
"campus": "Sterre",
|
||||||
"building": "S9",
|
"building": "S9",
|
||||||
|
@ -50,8 +54,12 @@
|
||||||
},
|
},
|
||||||
"6": {
|
"6": {
|
||||||
"canceled": true
|
"canceled": true
|
||||||
|
},
|
||||||
|
"10,11,12": {
|
||||||
|
"online_only": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"online": "zoom",
|
||||||
"location": {
|
"location": {
|
||||||
"campus": "Sterre",
|
"campus": "Sterre",
|
||||||
"building": "S9",
|
"building": "S9",
|
||||||
|
@ -67,8 +75,12 @@
|
||||||
"weeks": {
|
"weeks": {
|
||||||
"6": {
|
"6": {
|
||||||
"canceled": true
|
"canceled": true
|
||||||
|
},
|
||||||
|
"10,11,12": {
|
||||||
|
"online_only": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"online": "zoom",
|
||||||
"location": {
|
"location": {
|
||||||
"campus": "Sterre",
|
"campus": "Sterre",
|
||||||
"building": "S9",
|
"building": "S9",
|
||||||
|
@ -85,7 +97,8 @@
|
||||||
{
|
{
|
||||||
"course": "Parallelle Computersystemen",
|
"course": "Parallelle Computersystemen",
|
||||||
"online_links": {
|
"online_links": {
|
||||||
"zoom": "https://ufora.ugent.be/d2l/ext/rp/449671/lti/framedlaunch/556e197e-e87b-4c27-be5d-53adc7a41826"
|
"zoom": "https://ufora.ugent.be/d2l/ext/rp/449671/lti/framedlaunch/556e197e-e87b-4c27-be5d-53adc7a41826",
|
||||||
|
"opencast": "https://elosp.ugent.be/opencastplanner/live/GCMobile-ocrec79"
|
||||||
},
|
},
|
||||||
"slots": [
|
"slots": [
|
||||||
{
|
{
|
||||||
|
@ -94,6 +107,7 @@
|
||||||
"canceled": true
|
"canceled": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"online": "opencast",
|
||||||
"location": {
|
"location": {
|
||||||
"campus": "Ardoyen",
|
"campus": "Ardoyen",
|
||||||
"building": "iGent 126",
|
"building": "iGent 126",
|
||||||
|
@ -106,6 +120,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"online": "opencast",
|
||||||
"location": {
|
"location": {
|
||||||
"campus": "Ardoyen",
|
"campus": "Ardoyen",
|
||||||
"building": "iGent 126",
|
"building": "iGent 126",
|
||||||
|
@ -152,8 +167,12 @@
|
||||||
},
|
},
|
||||||
"6": {
|
"6": {
|
||||||
"canceled": true
|
"canceled": true
|
||||||
|
},
|
||||||
|
"10,11,12": {
|
||||||
|
"online_only": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"online": "zoom",
|
||||||
"location": {
|
"location": {
|
||||||
"campus": "Ardoyen",
|
"campus": "Ardoyen",
|
||||||
"building": "iGent 125",
|
"building": "iGent 125",
|
||||||
|
@ -169,13 +188,20 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"course": "Wiskundige Modellering",
|
"course": "Wiskundige Modellering",
|
||||||
|
"online_links": {
|
||||||
|
"zoom": "https://ufora.ugent.be/d2l/ext/rp/446530/lti/framedlaunch/556e197e-e87b-4c27-be5d-53adc7a41826"
|
||||||
|
},
|
||||||
"slots": [
|
"slots": [
|
||||||
{
|
{
|
||||||
"weeks": {
|
"weeks": {
|
||||||
"6": {
|
"6": {
|
||||||
"canceled": true
|
"canceled": true
|
||||||
|
},
|
||||||
|
"10,11,12": {
|
||||||
|
"online_only": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"online": "zoom",
|
||||||
"location": {
|
"location": {
|
||||||
"campus": "Sterre",
|
"campus": "Sterre",
|
||||||
"building": "S9",
|
"building": "S9",
|
||||||
|
@ -191,8 +217,12 @@
|
||||||
"weeks": {
|
"weeks": {
|
||||||
"6": {
|
"6": {
|
||||||
"canceled": true
|
"canceled": true
|
||||||
|
},
|
||||||
|
"10,11,12": {
|
||||||
|
"online_only": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"online": "zoom",
|
||||||
"location": {
|
"location": {
|
||||||
"campus": "Sterre",
|
"campus": "Sterre",
|
||||||
"building": "S8",
|
"building": "S8",
|
||||||
|
@ -208,8 +238,12 @@
|
||||||
"weeks": {
|
"weeks": {
|
||||||
"6": {
|
"6": {
|
||||||
"canceled": true
|
"canceled": true
|
||||||
|
},
|
||||||
|
"10,11,12": {
|
||||||
|
"online_only": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"online": "zoom",
|
||||||
"location": {
|
"location": {
|
||||||
"campus": "Sterre",
|
"campus": "Sterre",
|
||||||
"building": "S8",
|
"building": "S8",
|
||||||
|
@ -242,8 +276,12 @@
|
||||||
"weeks": {
|
"weeks": {
|
||||||
"6": {
|
"6": {
|
||||||
"canceled": true
|
"canceled": true
|
||||||
|
},
|
||||||
|
"10,11,12": {
|
||||||
|
"online_only": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"online": "zoom",
|
||||||
"location": {
|
"location": {
|
||||||
"campus": "Sterre",
|
"campus": "Sterre",
|
||||||
"building": "S9",
|
"building": "S9",
|
||||||
|
@ -259,8 +297,12 @@
|
||||||
"weeks": {
|
"weeks": {
|
||||||
"6": {
|
"6": {
|
||||||
"canceled": true
|
"canceled": true
|
||||||
|
},
|
||||||
|
"10,11,12": {
|
||||||
|
"online_only": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"online": "zoom",
|
||||||
"location": {
|
"location": {
|
||||||
"campus": "Sterre",
|
"campus": "Sterre",
|
||||||
"building": "S9",
|
"building": "S9",
|
||||||
|
@ -276,8 +318,12 @@
|
||||||
"weeks": {
|
"weeks": {
|
||||||
"6": {
|
"6": {
|
||||||
"canceled": true
|
"canceled": true
|
||||||
|
},
|
||||||
|
"10,11,12": {
|
||||||
|
"online_only": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"online": "zoom",
|
||||||
"location": {
|
"location": {
|
||||||
"campus": "Sterre",
|
"campus": "Sterre",
|
||||||
"building": "S9",
|
"building": "S9",
|
||||||
|
@ -301,8 +347,12 @@
|
||||||
"weeks": {
|
"weeks": {
|
||||||
"6": {
|
"6": {
|
||||||
"canceled": true
|
"canceled": true
|
||||||
|
},
|
||||||
|
"10,11,12": {
|
||||||
|
"online_only": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"online": "zoom",
|
||||||
"location": {
|
"location": {
|
||||||
"campus": "Sterre",
|
"campus": "Sterre",
|
||||||
"building": "S8",
|
"building": "S8",
|
||||||
|
@ -318,8 +368,12 @@
|
||||||
"weeks": {
|
"weeks": {
|
||||||
"6": {
|
"6": {
|
||||||
"canceled": true
|
"canceled": true
|
||||||
|
},
|
||||||
|
"10,11,12": {
|
||||||
|
"online_only": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"online": "zoom",
|
||||||
"location": {
|
"location": {
|
||||||
"campus": "Sterre",
|
"campus": "Sterre",
|
||||||
"building": "S9",
|
"building": "S9",
|
||||||
|
@ -338,8 +392,12 @@
|
||||||
},
|
},
|
||||||
"6": {
|
"6": {
|
||||||
"canceled": true
|
"canceled": true
|
||||||
|
},
|
||||||
|
"10,11,12": {
|
||||||
|
"online_only": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"online": "zoom",
|
||||||
"location": {
|
"location": {
|
||||||
"campus": "Sterre",
|
"campus": "Sterre",
|
||||||
"building": "S9",
|
"building": "S9",
|
||||||
|
@ -356,7 +414,8 @@
|
||||||
{
|
{
|
||||||
"course": "Besturingssystemen",
|
"course": "Besturingssystemen",
|
||||||
"online_links": {
|
"online_links": {
|
||||||
"zoom": "https://ufora.ugent.be/d2l/ext/rp/442814/lti/framedlaunch/556e197e-e87b-4c27-be5d-53adc7a41826"
|
"zoom": "https://ufora.ugent.be/d2l/ext/rp/442814/lti/framedlaunch/556e197e-e87b-4c27-be5d-53adc7a41826",
|
||||||
|
"opencast": "https://elosp.ugent.be/opencastplanner/live/GCMobile-ocrec79"
|
||||||
},
|
},
|
||||||
"slots": [
|
"slots": [
|
||||||
{
|
{
|
||||||
|
@ -369,6 +428,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"online": "opencast",
|
||||||
"location": {
|
"location": {
|
||||||
"campus": "Ardoyen",
|
"campus": "Ardoyen",
|
||||||
"building": "iGent 126",
|
"building": "iGent 126",
|
||||||
|
@ -381,6 +441,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
"online": "opencast",
|
||||||
"location": {
|
"location": {
|
||||||
"campus": "Ardoyen",
|
"campus": "Ardoyen",
|
||||||
"building": "iGent 126",
|
"building": "iGent 126",
|
||||||
|
|
Loading…
Reference in New Issue