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
c10beab6
Commit
c10beab6
authored
5 years ago
by
Nik | Klampfradler
Browse files
Options
Downloads
Patches
Plain Diff
Always fill the full timetable. Closes
#14
.
parent
fea3df18
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
biscuit/apps/chronos/views.py
+9
-9
9 additions, 9 deletions
biscuit/apps/chronos/views.py
with
9 additions
and
9 deletions
biscuit/apps/chronos/views.py
+
9
−
9
View file @
c10beab6
...
@@ -43,27 +43,27 @@ def timetable(request: HttpRequest) -> HttpResponse:
...
@@ -43,27 +43,27 @@ def timetable(request: HttpRequest) -> HttpResponse:
elif
lesson_periods
.
filter
(
lesson__teachers
=
request
.
user
.
person
).
exists
():
elif
lesson_periods
.
filter
(
lesson__teachers
=
request
.
user
.
person
).
exists
():
return
redirect
(
reverse
(
'
timetable
'
)
+
'
?teacher=%d
'
%
request
.
user
.
person
.
pk
)
return
redirect
(
reverse
(
'
timetable
'
)
+
'
?teacher=%d
'
%
request
.
user
.
person
.
pk
)
# Regroup lesson periods per weekday
per_day
=
{}
per_day
=
{}
period_min
,
period_max
=
None
,
None
for
lesson_period
in
lesson_periods
:
for
lesson_period
in
lesson_periods
:
per_day
.
setdefault
(
lesson_period
.
period
.
weekday
,
per_day
.
setdefault
(
lesson_period
.
period
.
weekday
,
{})[
lesson_period
.
period
.
period
]
=
lesson_period
{})[
lesson_period
.
period
.
period
]
=
lesson_period
# Expand min and max lesson to later fill in empty lessons
# Determine overall first and last day and period
if
period_min
is
None
or
period_min
>
lesson_period
.
period
.
period
:
min_max
=
TimePeriod
.
objects
..
aggregate
(
period_min
=
lesson_period
.
period
.
period
Min
(
'
period
'
),
Max
(
'
period
'
),
if
period_max
is
None
or
period_max
<
lesson_period
.
period
.
period
:
Min
(
'
weekday
'
),
Max
(
'
weekday
'
))
period_max
=
lesson_period
.
period
.
period
# Fill in empty lessons
# Fill in empty lessons
for
weekday_num
in
range
(
min
(
per_day
.
keys
()
or
[
0
]
),
for
weekday_num
in
range
(
min
_max
.
get
(
'
weekday__min
'
,
0
),
m
ax
(
per_day
.
keys
()
or
[
6
]
)
+
1
):
m
in_max
.
get
(
'
weekday__max
'
,
6
)
+
1
):
# Fill in empty weekdays
# Fill in empty weekdays
if
weekday_num
not
in
per_day
.
keys
():
if
weekday_num
not
in
per_day
.
keys
():
per_day
[
weekday_num
]
=
{}
per_day
[
weekday_num
]
=
{}
# Fill in empty lessons on this workday
# Fill in empty lessons on this workday
for
period_num
in
range
(
period_min
,
period_max
+
1
):
for
period_num
in
range
(
min_max
.
get
(
'
period__min
'
,
1
),
min_max
.
get
(
'
period__max
'
,
7
)
+
1
):
if
period_num
not
in
per_day
[
weekday_num
].
keys
():
if
period_num
not
in
per_day
[
weekday_num
].
keys
():
per_day
[
weekday_num
][
period_num
]
=
None
per_day
[
weekday_num
][
period_num
]
=
None
...
...
This diff is collapsed.
Click to expand it.
Nik | Klampfradler
@nik
mentioned in commit
05ef69cd
·
5 years ago
mentioned in commit
05ef69cd
mentioned in commit 05ef69cde06d58c07f93736fea2cdd63541c5599
Toggle commit list
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