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
6b8db972
Verified
Commit
6b8db972
authored
5 years ago
by
Nik | Klampfradler
Browse files
Options
Downloads
Patches
Plain Diff
Run autopep8.
parent
d9a3e66d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
biscuit/apps/chronos/models.py
+7
-7
7 additions, 7 deletions
biscuit/apps/chronos/models.py
biscuit/apps/chronos/templatetags/week_helpers.py
+2
-2
2 additions, 2 deletions
biscuit/apps/chronos/templatetags/week_helpers.py
with
9 additions
and
9 deletions
biscuit/apps/chronos/models.py
+
7
−
7
View file @
6b8db972
...
...
@@ -72,25 +72,25 @@ class LessonPeriodQuerySet(models.QuerySet):
"""
Filter for all lessons a participant (student) attends.
"""
return
self
.
filter
(
Q
(
lesson__groups__members
=
person
)
|
Q
(
lesson__groups__parent_groups__members
=
person
))
Q
(
lesson__groups__members
=
person
)
|
Q
(
lesson__groups__parent_groups__members
=
person
))
def
filter_group
(
self
,
group
:
Union
[
Group
,
int
]):
"""
Filter for all lessons a group (class) regularly attends.
"""
return
self
.
filter
(
Q
(
lesson__groups
=
group
)
|
Q
(
lesson__groups__parent_groups
=
group
))
Q
(
lesson__groups
=
group
)
|
Q
(
lesson__groups__parent_groups
=
group
))
def
filter_teacher
(
self
,
teacher
:
Union
[
Person
,
int
]):
"""
Filter for all lessons given by a certain teacher.
"""
return
self
.
filter
(
Q
(
substitutions__teachers
=
teacher
,
substitutions__week
=
models
.
F
(
'
_week
'
))
|
Q
(
lesson__teachers
=
teacher
))
Q
(
substitutions__teachers
=
teacher
,
substitutions__week
=
models
.
F
(
'
_week
'
))
|
Q
(
lesson__teachers
=
teacher
))
def
filter_room
(
self
,
room
:
Union
[
Room
,
int
]):
"""
Filter for all lessons taking part in a certain room.
"""
return
self
.
filter
(
Q
(
substitutions__room
=
room
,
substitutions__week
=
models
.
F
(
'
_week
'
))
|
Q
(
room
=
room
))
Q
(
substitutions__room
=
room
,
substitutions__week
=
models
.
F
(
'
_week
'
))
|
Q
(
room
=
room
))
def
annotate_week
(
self
,
week
:
Union
[
CalendarWeek
,
int
]):
"""
Annotate all lessons in the QuerySet with the number of the provided calendar week.
"""
...
...
@@ -233,7 +233,7 @@ class Lesson(SchoolRelated):
def
get_calendar_week
(
self
,
week
:
int
):
year
=
self
.
date_start
.
year
if
week
<
int
(
self
.
date_start
.
strftime
(
'
%V
'
)):
year
+=
1
year
+=
1
return
CalendarWeek
(
year
=
year
,
week
=
week
)
...
...
@@ -319,8 +319,8 @@ class LessonPeriod(SchoolRelated):
def
__str__
(
self
)
->
str
:
return
'
%s, %d., %s, %s
'
%
(
self
.
period
.
get_weekday_display
(),
self
.
period
.
period
,
'
,
'
.
join
(
list
(
self
.
lesson
.
groups
.
values_list
(
'
short_name
'
,
flat
=
True
))),
self
.
lesson
.
subject
.
name
)
'
,
'
.
join
(
list
(
self
.
lesson
.
groups
.
values_list
(
'
short_name
'
,
flat
=
True
))),
self
.
lesson
.
subject
.
name
)
class
Meta
:
ordering
=
[
'
lesson__date_start
'
,
'
period__weekday
'
,
'
period__period
'
]
...
...
This diff is collapsed.
Click to expand it.
biscuit/apps/chronos/templatetags/week_helpers.py
+
2
−
2
View file @
6b8db972
...
...
@@ -22,8 +22,8 @@ def week_end(week: CalendarWeek) -> date:
@register.filter
def
only_week
(
qs
:
QuerySet
,
week
:
Optional
[
CalendarWeek
])
->
QuerySet
:
wanted_week
=
week
or
CalendarWeek
()
return
qs
.
filter
(
week
=
wanted_week
.
week
)
wanted_week
=
week
or
CalendarWeek
()
return
qs
.
filter
(
week
=
wanted_week
.
week
)
@register.simple_tag
...
...
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