Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-App-Alsijil
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-Alsijil
Commits
2c09920d
Verified
Commit
2c09920d
authored
4 years ago
by
Jonathan Weth
Browse files
Options
Downloads
Patches
Plain Diff
Support events and extra lessons in full register printout
parent
b0572970
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!120
Resolve "Support events and extra lessons in class register"
Pipeline
#5869
passed
4 years ago
Stage: test
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aleksis/apps/alsijil/templates/alsijil/print/full_register.html
+36
-14
36 additions, 14 deletions
...s/apps/alsijil/templates/alsijil/print/full_register.html
aleksis/apps/alsijil/views.py
+54
-5
54 additions, 5 deletions
aleksis/apps/alsijil/views.py
with
90 additions
and
19 deletions
aleksis/apps/alsijil/templates/alsijil/print/full_register.html
+
36
−
14
View file @
2c09920d
...
...
@@ -317,14 +317,26 @@
<tbody>
{% for note in person.personal_notes.all %}
{% if note.
lesson_period in lesson_period
s %}
{% if note.
register_object in register_object
s %}
{% if note.absent or note.late or note.remarks or note.extra_marks.all %}
{% weekday_to_date note.calendar_week note.lesson_period.period.weekday as note_date %}
<tr>
<td>
{{ note_date }}
</td>
<td>
{{ note.lesson_period.period.period }}
</td>
<td>
{{ note.lesson_period.get_subject.short_name }}
</td>
<td>
{{ note.lesson_period.get_teachers.first.short_name }}
</td>
{% if note.date %}
<td>
{{ note.date }}
</td>
<td>
{{ note.register_object.period.period }}
</td>
{% else %}
<td
colspan=
"2"
>
{{ note.register_object.date_start }} {{ note.register_object.period_from.period }}.–{{ note.register_object.date_end }}
{{ note.register_object.period_to.period }}.
</td>
{% endif %}
<td>
{% if note.register_object.label_ != "event" %}
{{ note.register_object.get_subject.short_name }}
{% else %}
{% trans "Event" %}
{% endif %}
</td>
<td>
{{ note.register_object.teacher_short_names }}
</td>
<td>
{% if note.absent %}
{% trans 'Yes' %}
...
...
@@ -376,8 +388,8 @@
</thead>
<tbody>
{% for day in week %}
{% with
period
s_by_day|get_dict:day as
period
s %}
{% for
period
, documentations, notes, substitution in
period
s %}
{% with
register_object
s_by_day|get_dict:day as
register_object
s %}
{% for
register_object
, documentations, notes, substitution in
register_object
s %}
<tr
class=
"
{% if substitution %}
{% if substitution.cancelled %}
...
...
@@ -391,18 +403,28 @@
{% endif %}
"
>
{% if forloop.first %}
<th
rowspan=
"{{
period
s|length }}"
class=
"lessons-day-head"
>
{{ day }}
</th>
<th
rowspan=
"{{
register_object
s|length }}"
class=
"lessons-day-head"
>
{{ day }}
</th>
{% endif %}
<td
class=
"lesson-pe"
>
{{ period.period.period }}
</td>
<td
class=
"lesson-pe"
>
{% if register_object.label_ != "event" %}
{{ register_object.period.period }}
{% else %}
{{ register_object.period_from_on_day }}.–{{ register_object.period_to_on_day }}.
{% endif %}
</td>
<td
class=
"lesson-subj"
>
{% if substitution %}
{% if register_object.label_ == "event" %}
<strong>
{% trans "Event" %}
</strong>
{% elif substitution %}
{% include "chronos/partials/subs/subject.html" with type="substitution" el=substitution %}
{% else %}
{% include "chronos/partials/subject.html" with subject=
period.lesson.
subject %}
{% include "chronos/partials/subject.html" with subject=
register_object.get_
subject %}
{% endif %}
</td>
<td
class=
"lesson-topic"
>
{% if substitution.cancelled %}
{% if register_object.label_ == "event" %}
{{ register_object.title }}: {{ documentations.0.topic }}
{% elif substitution.cancelled %}
{% trans 'Lesson cancelled' %}
{% else %}
{{ documentations.0.topic }}
...
...
@@ -453,7 +475,7 @@
</td>
<td
class=
"lesson-te"
>
{% if documentations.0.topic %}
{{ substitution.teachers.first.short_name|default:
period.lesson.
teachers.first.short_name }}
{{ substitution.teachers.first.short_name|default:
register_object.get_
teachers.first.short_name }}
{% endif %}
</td>
</tr>
...
...
This diff is collapsed.
Click to expand it.
aleksis/apps/alsijil/views.py
+
54
−
5
View file @
2c09920d
...
...
@@ -493,10 +493,59 @@ def full_register_group(request: HttpRequest, id_: int) -> HttpResponse:
"
personal_notes__groups_of_person
"
,
)
)
events
=
(
Event
.
objects
.
filter_group
(
group
)
.
distinct
()
.
prefetch_related
(
"
documentations
"
,
"
personal_notes
"
,
"
personal_notes__excuse_type
"
,
"
personal_notes__extra_marks
"
,
"
personal_notes__person
"
,
"
personal_notes__groups_of_person
"
,
)
)
extra_lessons
=
(
ExtraLesson
.
objects
.
filter_group
(
group
)
.
distinct
()
.
prefetch_related
(
"
documentations
"
,
"
personal_notes
"
,
"
personal_notes__excuse_type
"
,
"
personal_notes__extra_marks
"
,
"
personal_notes__person
"
,
"
personal_notes__groups_of_person
"
,
)
)
weeks
=
CalendarWeek
.
weeks_within
(
group
.
school_term
.
date_start
,
group
.
school_term
.
date_end
)
register_objects_by_day
=
{}
for
extra_lesson
in
extra_lessons
:
day
=
extra_lesson
.
date
register_objects_by_day
.
setdefault
(
day
,
[]).
append
(
(
extra_lesson
,
list
(
extra_lesson
.
documentations
.
all
()),
list
(
extra_lesson
.
personal_notes
.
all
()),
None
,
)
)
weeks
=
CalendarWeek
.
weeks_within
(
group
.
school_term
.
date_start
,
group
.
school_term
.
date_end
,)
for
event
in
events
:
day_number
=
(
event
.
date_end
-
event
.
date_start
).
days
+
1
for
i
in
range
(
day_number
):
day
=
event
.
date_start
+
timedelta
(
days
=
i
)
event_copy
=
deepcopy
(
event
)
event_copy
.
annotate_day
(
day
)
register_objects_by_day
.
setdefault
(
day
,
[]).
append
(
(
event_copy
,
list
(
event_copy
.
documentations
.
all
()),
list
(
event_copy
.
personal_notes
.
all
()),
None
,
)
)
periods_by_day
=
{}
for
lesson_period
in
lesson_periods
:
for
week
in
weeks
:
day
=
week
[
lesson_period
.
period
.
weekday
]
...
...
@@ -520,7 +569,7 @@ def full_register_group(request: HttpRequest, id_: int) -> HttpResponse:
)
substitution
=
lesson_period
.
get_substitution
(
week
)
period
s_by_day
.
setdefault
(
day
,
[]).
append
(
register_object
s_by_day
.
setdefault
(
day
,
[]).
append
(
(
lesson_period
,
documentations
,
notes
,
substitution
)
)
...
...
@@ -543,8 +592,8 @@ def full_register_group(request: HttpRequest, id_: int) -> HttpResponse:
context
[
"
extra_marks
"
]
=
ExtraMark
.
objects
.
all
()
context
[
"
group
"
]
=
group
context
[
"
weeks
"
]
=
weeks
context
[
"
periods_by_day
"
]
=
period
s_by_day
context
[
"
lesson_period
s
"
]
=
lesson_periods
context
[
"
register_objects_by_day
"
]
=
register_object
s_by_day
context
[
"
register_object
s
"
]
=
list
(
lesson_periods
)
+
list
(
events
)
+
list
(
extra_lessons
)
context
[
"
today
"
]
=
date
.
today
()
context
[
"
lessons
"
]
=
(
group
.
lessons
.
all
()
...
...
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