Skip to content
Snippets Groups Projects
Verified Commit 0cc8f22f authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Merge branch 'master' of edugit.org:AlekSIS/official/AlekSIS-App-Chronos

parents 40e803d9 dea5c8db
No related branches found
No related tags found
No related merge requests found
......@@ -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"),
)
......@@ -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
......
......@@ -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:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment