diff --git a/uqcsbot/utils/uq_course_utils.py b/uqcsbot/utils/uq_course_utils.py index 9343222..898e82d 100644 --- a/uqcsbot/utils/uq_course_utils.py +++ b/uqcsbot/utils/uq_course_utils.py @@ -159,14 +159,14 @@ def is_before(self, cutoff: datetime): return True return start_datetime <= cutoff - def get_weight_as_int(self) -> Optional[int]: + def get_weight_as_int(self): """ - Trys to get the weight percentage of an assessment as a percentage. Will return None + Trys to get the weight percentage of an assessment as a percentage. Will return 0 if a percentage can not be obtained. """ if match := re.match(r"\d+", self.weight): return int(match.group(0)) - return None + return 0 class DateSyntaxException(Exception): diff --git a/uqcsbot/whatsdue.py b/uqcsbot/whatsdue.py index 98528c1..dbfc30e 100644 --- a/uqcsbot/whatsdue.py +++ b/uqcsbot/whatsdue.py @@ -37,7 +37,7 @@ def sort_by_date(item: AssessmentItem): ] = { "Date": sort_by_date, "Course Name": (lambda item: item.course_name), - "Weight": (lambda item: item.get_weight_as_int() or 0), + "Weight": item.get_weight_as_int(), }