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

Reformat

parent a71d04c2
No related branches found
No related tags found
1 merge request!301New data model based on calendar events
# flake8: noqa: DJ01 # flake8: noqa: DJ01
from __future__ import annotations from __future__ import annotations
import os
import itertools import itertools
import os
from datetime import date, datetime, time, timedelta from datetime import date, datetime, time, timedelta
from itertools import chain from itertools import chain
from typing import Any, Dict, Iterable, Iterator, List, Optional, Tuple, Union from typing import Any, Dict, Iterable, Iterator, List, Optional, Tuple, Union
...@@ -1414,7 +1414,7 @@ class LessonEvent(CalendarEvent): ...@@ -1414,7 +1414,7 @@ class LessonEvent(CalendarEvent):
@property @property
def teacher_names(self: "LessonEvent") -> str: def teacher_names(self: "LessonEvent") -> str:
return ", ".join([t.full_name for t in self.teachers.all()]) return ", ".join([t.full_name for t in self.teachers.all()])
@property @property
def room_names(self: "LessonEvent") -> str: def room_names(self: "LessonEvent") -> str:
...@@ -1426,11 +1426,7 @@ class LessonEvent(CalendarEvent): ...@@ -1426,11 +1426,7 @@ class LessonEvent(CalendarEvent):
if reference_object.title: if reference_object.title:
return reference_object.title return reference_object.title
elif reference_object.subject: elif reference_object.subject:
return ( return reference_object.subject.name + " · " + reference_object.group_names
reference_object.subject.name
+ " · "
+ reference_object.group_names
)
return _("Lesson") return _("Lesson")
...@@ -1457,7 +1453,9 @@ class LessonEvent(CalendarEvent): ...@@ -1457,7 +1453,9 @@ class LessonEvent(CalendarEvent):
def value_attendee(cls, reference_object: "LessonEvent") -> str: def value_attendee(cls, reference_object: "LessonEvent") -> str:
"""Get the attendees of the event.""" """Get the attendees of the event."""
# FIXME: Permissions # FIXME: Permissions
attendees = [t.get_vcal_address(role="CHAIR") for t in reference_object.teachers.all()] + [g.get_vcal_address(role="REQ-PARTICIPANT") for g in reference_object.all_members] attendees = [t.get_vcal_address(role="CHAIR") for t in reference_object.teachers.all()] + [
g.get_vcal_address(role="REQ-PARTICIPANT") for g in reference_object.all_members
]
return [a for a in attendees if a] return [a for a in attendees if a]
@classmethod @classmethod
...@@ -1484,7 +1482,6 @@ class SupervisionEvent(LessonEvent): ...@@ -1484,7 +1482,6 @@ class SupervisionEvent(LessonEvent):
name = "supervision" name = "supervision"
verbose_name = _("Supervisions") verbose_name = _("Supervisions")
@classmethod @classmethod
def value_title(cls, reference_object: "LessonEvent") -> str: def value_title(cls, reference_object: "LessonEvent") -> str:
"""Get the title of the event.""" """Get the title of the event."""
...@@ -1493,4 +1490,6 @@ class SupervisionEvent(LessonEvent): ...@@ -1493,4 +1490,6 @@ class SupervisionEvent(LessonEvent):
@classmethod @classmethod
def value_description(cls, reference_object: "LessonEvent") -> str: def value_description(cls, reference_object: "LessonEvent") -> str:
return render_to_string("chronos/supervision_event_description.txt", {"event": reference_object}) return render_to_string(
\ No newline at end of file "chronos/supervision_event_description.txt", {"event": reference_object}
)
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