Remove unnecessary setting, add check around schedule parsing

pull/135/head
stijndcl 2022-09-25 15:25:29 +02:00
parent 3167c99645
commit 1df345838d
2 changed files with 5 additions and 5 deletions

View File

@ -131,9 +131,11 @@ class ScheduleSlot:
def __post_init__(self): def __post_init__(self):
"""Fix some properties to display more nicely""" """Fix some properties to display more nicely"""
# Re-format the location data # Re-format the location data
room, building, campus = re.search(r"(.*)\. (?:Gebouw )?(.*)\. (?:Campus )?(.*)\. ", self.location).groups() match = re.search(r"(.*)\. (?:Gebouw )?(.*)\. (?:Campus )?(.*)\. ", self.location)
room = room.replace("PC / laptoplokaal ", "PC-lokaal") if match is not None:
self.location = f"{campus} {building} {room}" room, building, campus = match.groups()
room = room.replace("PC / laptoplokaal ", "PC-lokaal")
self.location = f"{campus} {building} {room}"
# The same course can only start once at the same moment, # The same course can only start once at the same moment,
# so this is guaranteed to be unique # so this is guaranteed to be unique

View File

@ -29,7 +29,6 @@ __all__ = [
"DISCORD_CUSTOM_COMMAND_PREFIX", "DISCORD_CUSTOM_COMMAND_PREFIX",
"UFORA_ANNOUNCEMENTS_CHANNEL", "UFORA_ANNOUNCEMENTS_CHANNEL",
"UFORA_RSS_TOKEN", "UFORA_RSS_TOKEN",
"URBAN_DICTIONARY_TOKEN",
"IMGFLIP_NAME", "IMGFLIP_NAME",
"IMGFLIP_PASSWORD", "IMGFLIP_PASSWORD",
"ScheduleType", "ScheduleType",
@ -77,7 +76,6 @@ MA_CS_ENG_2_ROLE: Optional[int] = env.int("MA_CS_ENG_2_ROLE", 102330043480016491
"""API Keys""" """API Keys"""
UFORA_RSS_TOKEN: Optional[str] = env.str("UFORA_RSS_TOKEN", None) UFORA_RSS_TOKEN: Optional[str] = env.str("UFORA_RSS_TOKEN", None)
URBAN_DICTIONARY_TOKEN: Optional[str] = env.str("URBAN_DICTIONARY_TOKEN", None)
IMGFLIP_NAME: Optional[str] = env.str("IMGFLIP_NAME", None) IMGFLIP_NAME: Optional[str] = env.str("IMGFLIP_NAME", None)
IMGFLIP_PASSWORD: Optional[str] = env.str("IMGFLIP_PASSWORD", None) IMGFLIP_PASSWORD: Optional[str] = env.str("IMGFLIP_PASSWORD", None)