Rework schedule a bit to make it more maintainable & easier to code

This commit is contained in:
Stijn De Clercq 2021-08-06 23:47:50 +02:00
parent 54d31c943a
commit 1857bdefe9
4 changed files with 161 additions and 94 deletions

View file

@ -1,7 +1,8 @@
from enum import Enum
from typing import Optional
class Platforms(Enum):
class Platform(Enum):
"""
An Enum to represent online class platforms
Name: The name of the platform
@ -11,3 +12,17 @@ class Platforms(Enum):
MSTeams = {"name": "MS Teams", "rep": "msteams"}
Ufora = {"name": "Ufora", "rep": "ufora"}
Zoom = {"name": "Zoom", "rep": "zoom"}
def get_platform(rep: Optional[str]) -> Optional[Platform]:
"""
Find the platform that corresponds to the given name
"""
if rep is None:
return None
for platform in Platform:
if platform.value["rep"] == rep:
return platform
return None