Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-App-Chronos
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AlekSIS®
Official
AlekSIS-App-Chronos
Commits
1e979f87
Verified
Commit
1e979f87
authored
1 year ago
by
Jonathan Weth
Browse files
Options
Downloads
Patches
Plain Diff
Reformat
parent
a71d04c2
No related branches found
No related tags found
1 merge request
!301
New data model based on calendar events
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
aleksis/apps/chronos/models.py
+9
-10
9 additions, 10 deletions
aleksis/apps/chronos/models.py
with
9 additions
and
10 deletions
aleksis/apps/chronos/models.py
+
9
−
10
View file @
1e979f87
# 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
}
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment