diff --git a/aleksis/apps/chronos/apps.py b/aleksis/apps/chronos/apps.py index 20005412be9701f19f7ba5ff13b79e4c5baf5f09..66d0b0e7ac22805fe0e06ec444890656676f3200 100644 --- a/aleksis/apps/chronos/apps.py +++ b/aleksis/apps/chronos/apps.py @@ -13,6 +13,7 @@ class ChronosConfig(AppConfig): ([2018, 2019, 2020], "Jonathan Weth", "wethjo@katharineum.de"), ([2018, 2019], "Frank Poetzsch-Heffter", "p-h@katharineum.de"), ([2019, 2020], "Dominik George", "dominik.george@teckids.org"), + ([2019], "Julian Leucker", "leuckeju@katharineum.de"), ([2019], "Tom Teichler", "tom.teichler@teckids.org"), ([2019], "Hangzhi Yu", "yuha@katharineum.de"), ) diff --git a/aleksis/apps/chronos/util/date.py b/aleksis/apps/chronos/util/date.py index f17aa0ba8354b9dce1ed9db5ee158954afc71ea0..feb63bc8de2f7e3c9ea0dc68a6d4b187b5c80d0b 100644 --- a/aleksis/apps/chronos/util/date.py +++ b/aleksis/apps/chronos/util/date.py @@ -8,19 +8,22 @@ from django.utils.translation import gettext_lazy as _ def week_weekday_from_date(when: date) -> Tuple[CalendarWeek, int]: + """Return a tuple of week and weekday from a given date.""" return (CalendarWeek.from_date(when), when.weekday()) def week_weekday_to_date(week: CalendarWeek, weekday: int) -> date: + """Return a date object for one day in a calendar week.""" return week[weekday - 1] def week_period_to_date(week: Union[CalendarWeek, int], period) -> date: + """Return the date of a lesson period in a given week.""" return period.get_date(week) def get_weeks_for_year(year: int) -> List[CalendarWeek]: - """ Generates all weeks for one year """ + """Generate all weeks for one year.""" weeks = [] # Go for all weeks in year and create week list diff --git a/aleksis/apps/chronos/views.py b/aleksis/apps/chronos/views.py index 3ddecc1526e257ed0e1196d0cef56e1b78790b71..72821e75ad47d8f112cb507a7f3f7c0d43a66959 100644 --- a/aleksis/apps/chronos/views.py +++ b/aleksis/apps/chronos/views.py @@ -26,6 +26,7 @@ from aleksis.core.util.core_helpers import has_person, get_site_preferences @permission_required("chronos.view_timetable_overview") def all_timetables(request: HttpRequest) -> HttpResponse: + """View all timetables for persons, groups and rooms.""" context = {} teachers = Person.objects.annotate( @@ -56,6 +57,7 @@ def my_timetable( month: Optional[int] = None, day: Optional[int] = None, ) -> HttpResponse: + """View personal timetable on a specified date.""" context = {} if day: @@ -122,6 +124,7 @@ def timetable( week: Optional[int] = None, regular: Optional[str] = None, ) -> HttpResponse: + """View a selected timetable for a person, group or room.""" context = {} is_smart = regular != "regular" @@ -183,6 +186,7 @@ def lessons_day( month: Optional[int] = None, day: Optional[int] = None, ) -> HttpResponse: + """View all lessons taking place on a specified day.""" context = {} if day: @@ -225,6 +229,7 @@ def get_substitution_by_id(request: HttpRequest, id_: int, week: int): @permission_required("chronos.edit_substitution", fn=get_substitution_by_id) def edit_substitution(request: HttpRequest, id_: int, week: int) -> HttpResponse: + """View a form to edit a substitution lessen.""" context = {} lesson_period = get_object_or_404(LessonPeriod, pk=id_) @@ -263,6 +268,10 @@ def edit_substitution(request: HttpRequest, id_: int, week: int) -> HttpResponse @permission_required("chronos.delete_substitution", fn=get_substitution_by_id) def delete_substitution(request: HttpRequest, id_: int, week: int) -> HttpResponse: + """Delete a substitution lesson. + + Redirects back to substition list on success. + """ lesson_period = get_object_or_404(LessonPeriod, pk=id_) wanted_week = lesson_period.lesson.get_calendar_week(week) @@ -285,6 +294,7 @@ def substitutions( day: Optional[int] = None, is_print: bool = False, ) -> HttpResponse: + """View all substitutions on a spcified day.""" context = {} if day: