mirror of https://github.com/stijndcl/didier
Compare commits
No commits in common. "693fab7833f09ef7f47511cf51527c55e4137e68" and "9a2313d376d007454ebfa19613ae372848e96baa" have entirely different histories.
693fab7833
...
9a2313d376
|
|
@ -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,15 +95,14 @@ class Timeslot:
|
||||||
"""
|
"""
|
||||||
special = False
|
special = False
|
||||||
|
|
||||||
week = find_week(str(current_week), slot_dict)
|
if "weeks" in slot_dict and str(current_week) in slot_dict["weeks"]:
|
||||||
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(week)
|
slot_dict.update(slot_dict["weeks"][str(current_week)])
|
||||||
|
|
||||||
# Only happens online, not on-campus
|
# Only happens online, not on-campus
|
||||||
online_only = week.get("online_only", False)
|
online_only = slot_dict["weeks"][str(current_week)].get("online_only", False)
|
||||||
if online_only:
|
if online_only:
|
||||||
slot_dict.pop("location")
|
slot_dict.pop("location")
|
||||||
|
|
||||||
|
|
@ -407,9 +406,7 @@ class ScheduleEmbed(LesEmbed):
|
||||||
if not has_link:
|
if not has_link:
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
# Store in a set first to remove duplicates
|
return "\n".join(list(f"{entry.course}: **{entry.get_link_str()}**" for entry in has_link))
|
||||||
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]]:
|
||||||
|
|
@ -423,20 +420,3 @@ 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
|
|
||||||
|
|
|
||||||
|
|
@ -15,23 +15,19 @@
|
||||||
{
|
{
|
||||||
"name": "Beveiliging en parallelle systemen",
|
"name": "Beveiliging en parallelle systemen",
|
||||||
"role": 891744461405687808,
|
"role": 891744461405687808,
|
||||||
"schedule": [
|
|
||||||
{
|
|
||||||
"course": "Modelleren en Simuleren",
|
|
||||||
"online_links": {
|
"online_links": {
|
||||||
"zoom": "https://ufora.ugent.be/d2l/ext/rp/439235/lti/framedlaunch/556e197e-e87b-4c27-be5d-53adc7a41826"
|
"zoom": "https://ufora.ugent.be/d2l/ext/rp/439235/lti/framedlaunch/556e197e-e87b-4c27-be5d-53adc7a41826"
|
||||||
},
|
},
|
||||||
|
"schedule": [
|
||||||
|
{
|
||||||
|
"course": "Modelleren en Simuleren",
|
||||||
"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",
|
||||||
|
|
@ -54,12 +50,8 @@
|
||||||
},
|
},
|
||||||
"6": {
|
"6": {
|
||||||
"canceled": true
|
"canceled": true
|
||||||
},
|
|
||||||
"10,11,12": {
|
|
||||||
"online_only": true
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"online": "zoom",
|
|
||||||
"location": {
|
"location": {
|
||||||
"campus": "Sterre",
|
"campus": "Sterre",
|
||||||
"building": "S9",
|
"building": "S9",
|
||||||
|
|
@ -75,12 +67,8 @@
|
||||||
"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",
|
||||||
|
|
@ -97,8 +85,7 @@
|
||||||
{
|
{
|
||||||
"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": [
|
||||||
{
|
{
|
||||||
|
|
@ -107,7 +94,6 @@
|
||||||
"canceled": true
|
"canceled": true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"online": "opencast",
|
|
||||||
"location": {
|
"location": {
|
||||||
"campus": "Ardoyen",
|
"campus": "Ardoyen",
|
||||||
"building": "iGent 126",
|
"building": "iGent 126",
|
||||||
|
|
@ -120,7 +106,6 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"online": "opencast",
|
|
||||||
"location": {
|
"location": {
|
||||||
"campus": "Ardoyen",
|
"campus": "Ardoyen",
|
||||||
"building": "iGent 126",
|
"building": "iGent 126",
|
||||||
|
|
@ -167,12 +152,8 @@
|
||||||
},
|
},
|
||||||
"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",
|
||||||
|
|
@ -188,20 +169,13 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"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",
|
||||||
|
|
@ -217,12 +191,8 @@
|
||||||
"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",
|
||||||
|
|
@ -238,12 +208,8 @@
|
||||||
"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",
|
||||||
|
|
@ -276,12 +242,8 @@
|
||||||
"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",
|
||||||
|
|
@ -297,12 +259,8 @@
|
||||||
"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",
|
||||||
|
|
@ -318,12 +276,8 @@
|
||||||
"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",
|
||||||
|
|
@ -347,12 +301,8 @@
|
||||||
"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",
|
||||||
|
|
@ -368,12 +318,8 @@
|
||||||
"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",
|
||||||
|
|
@ -392,12 +338,8 @@
|
||||||
},
|
},
|
||||||
"6": {
|
"6": {
|
||||||
"canceled": true
|
"canceled": true
|
||||||
},
|
|
||||||
"10,11,12": {
|
|
||||||
"online_only": true
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"online": "zoom",
|
|
||||||
"location": {
|
"location": {
|
||||||
"campus": "Sterre",
|
"campus": "Sterre",
|
||||||
"building": "S9",
|
"building": "S9",
|
||||||
|
|
@ -414,8 +356,7 @@
|
||||||
{
|
{
|
||||||
"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": [
|
||||||
{
|
{
|
||||||
|
|
@ -428,7 +369,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"online": "opencast",
|
|
||||||
"location": {
|
"location": {
|
||||||
"campus": "Ardoyen",
|
"campus": "Ardoyen",
|
||||||
"building": "iGent 126",
|
"building": "iGent 126",
|
||||||
|
|
@ -441,7 +381,6 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"online": "opencast",
|
|
||||||
"location": {
|
"location": {
|
||||||
"campus": "Ardoyen",
|
"campus": "Ardoyen",
|
||||||
"building": "iGent 126",
|
"building": "iGent 126",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue