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
5f5f225a
Verified
Commit
5f5f225a
authored
4 years ago
by
Jonathan Weth
Browse files
Options
Downloads
Patches
Plain Diff
Add statistics on person overview
parent
af3dcfb3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!80
Resolve "Add student view with further information"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aleksis/apps/alsijil/templates/alsijil/class_register/person.html
+41
-0
41 additions, 0 deletions
...apps/alsijil/templates/alsijil/class_register/person.html
aleksis/apps/alsijil/views.py
+49
-0
49 additions, 0 deletions
aleksis/apps/alsijil/views.py
with
90 additions
and
0 deletions
aleksis/apps/alsijil/templates/alsijil/class_register/person.html
+
41
−
0
View file @
5f5f225a
...
...
@@ -42,6 +42,47 @@
</li>
{% endfor %}
</ul>
<h5>
{% trans "Statistics on absences, tardinesses and remarks" %}
</h5>
<ul
class=
"collapsible"
>
{% for school_term, stat in stats %}
<li
{%
if
forloop.first
%}
class=
"active"
{%
endif
%}
>
<div
class=
"collapsible-header"
>
<i
class=
"material-icons"
>
date_range
</i>
{{ school_term }}
</div>
<div
class=
"collapsible-body"
>
<table>
<tr>
<th
colspan=
"2"
>
{% trans 'Absences' %}
</th>
<td>
{{ stat.absences_count }}
</td>
</tr>
<tr>
<td
rowspan=
"{{ excuse_types.count|add:2 }}"
style=
"width: 16mm;"
class=
"rotate small-print"
>
{% trans "thereof" %}
</td>
<th>
{% trans 'Excused' %}
</th>
<td>
{{ stat.excused }}
</td>
</tr>
{% for excuse_type in excuse_types %}
<th>
{{ excuse_type.name }}
</th>
<td>
{{ stat|get_dict:excuse_type.count_label }}
</td>
{% endfor %}
<tr>
<th>
{% trans 'Unexcused' %}
</th>
<td>
{{ stat.unexcused }}
</td>
</tr>
<tr>
<th
colspan=
"2"
>
{% trans 'Tardiness' %}
</th>
<td>
{{ stat.tardiness }}'
</td>
</tr>
{% for extra_mark in extra_marks %}
<tr>
<th
colspan=
"2"
>
{{ extra_mark.name }}
</th>
<td>
{{ stat|get_dict:extra_mark.count_label }}
</td>
</tr>
{% endfor %}
</table>
</div>
</li>
{% endfor %}
</ul>
</div>
<div
class=
"col s12 m12 l6"
>
<h5>
{% trans "Relevant personal notes" %}
</h5>
...
...
This diff is collapsed.
Click to expand it.
aleksis/apps/alsijil/views.py
+
49
−
0
View file @
5f5f225a
...
...
@@ -529,6 +529,55 @@ def overview_person(request: HttpRequest, id_: Optional[int] = None) -> HttpResp
)
context
[
"
personal_notes
"
]
=
personal_notes
context
[
"
excuse_types
"
]
=
ExcuseType
.
objects
.
all
()
school_terms
=
SchoolTerm
.
objects
.
all
().
order_by
(
"
-date_start
"
)
stats
=
[]
for
school_term
in
school_terms
:
stat
=
{}
personal_notes
=
PersonalNote
.
objects
.
filter
(
person
=
person
,
lesson_period__lesson__validity__school_term
=
school_term
)
if
not
personal_notes
.
exists
():
continue
stat
.
update
(
personal_notes
.
filter
(
absent
=
True
).
aggregate
(
absences_count
=
Count
(
"
absent
"
))
)
stat
.
update
(
personal_notes
.
filter
(
absent
=
True
,
excused
=
True
,
excuse_type__isnull
=
True
).
aggregate
(
excused
=
Count
(
"
absent
"
))
)
stat
.
update
(
personal_notes
.
filter
(
absent
=
True
,
excused
=
False
).
aggregate
(
unexcused
=
Count
(
"
absent
"
)
)
)
stat
.
update
(
personal_notes
.
filter
(
absent
=
True
,
excused
=
False
).
aggregate
(
tardiness
=
Count
(
"
late
"
)
)
)
for
extra_mark
in
ExtraMark
.
objects
.
all
():
stat
.
update
(
personal_notes
.
filter
(
extra_marks
=
extra_mark
).
aggregate
(
**
{
extra_mark
.
count_label
:
Count
(
"
pk
"
)}
)
)
for
excuse_type
in
ExcuseType
.
objects
.
all
():
stat
.
update
(
personal_notes
.
filter
(
absent
=
True
,
excuse_type
=
excuse_type
).
aggregate
(
**
{
excuse_type
.
count_label
:
Count
(
"
absent
"
)}
)
)
stats
.
append
((
school_term
,
stat
))
context
[
"
stats
"
]
=
stats
context
[
"
excuse_types
"
]
=
ExcuseType
.
objects
.
all
()
context
[
"
extra_marks
"
]
=
ExtraMark
.
objects
.
all
()
return
render
(
request
,
"
alsijil/class_register/person.html
"
,
context
)
...
...
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