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
98984611
Verified
Commit
98984611
authored
5 years ago
by
Nik | Klampfradler
Browse files
Options
Downloads
Patches
Plain Diff
Add personal notes to group view. Closes
#18
.
parent
349a9ec4
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/alsijil/templates/alsijil/group_week.html
+19
-3
19 additions, 3 deletions
biscuit/apps/alsijil/templates/alsijil/group_week.html
biscuit/apps/alsijil/views.py
+16
-1
16 additions, 1 deletion
biscuit/apps/alsijil/views.py
with
35 additions
and
4 deletions
biscuit/apps/alsijil/templates/alsijil/group_week.html
+
19
−
3
View file @
98984611
...
...
@@ -60,9 +60,25 @@
<div
class=
"card-header bg-light text-dark"
>
{% blocktrans %}Personal notes{% endblocktrans %}
</div>
<div
class=
"card-body"
>
Not implemented yet.
</div>
{% for person in persons %}
<div
class=
"card-body"
>
<h5
class=
"card-title"
>
{{ person.full_name }}
</h5>
<p
class=
"card-text"
>
{% trans "Absent" %}: {{ person.absences }}
({{ person.unexcused }} {% trans "unexcused" %})
</p>
<p
class=
"card-text"
>
{% trans "Summed up tardiness" %}: {{ person.tardiness }}
</p>
{% for note in person.personal_notes %}
{% if note.remarks %}
<p
class=
"card-text"
>
{{ note.remarks }}
</p>
{% endif %}
{% endfor %}
</div>
{% endfor %}
</div>
</div>
</div>
...
...
This diff is collapsed.
Click to expand it.
biscuit/apps/alsijil/views.py
+
16
−
1
View file @
98984611
...
...
@@ -2,7 +2,7 @@ from collections import OrderedDict
from
typing
import
Optional
from
django.contrib.auth.decorators
import
login_required
from
django.db.models
import
Exists
,
OuterRef
,
Q
from
django.db.models
import
Count
,
Exists
,
OuterRef
,
Q
,
Sum
from
django.http
import
Http404
,
HttpRequest
,
HttpResponse
from
django.shortcuts
import
render
from
django.utils.translation
import
ugettext
as
_
...
...
@@ -101,6 +101,7 @@ def group_week(request: HttpRequest, week: Optional[int] = None) -> HttpResponse
if
not
group
:
raise
Http404
(
_
(
'
You must select a group to see the week summary.
'
))
# Get all lesson periods for the selected group
lesson_periods
=
LessonPeriod
.
objects
.
filter
(
lesson__date_start__lte
=
week_start
,
lesson__date_end__gte
=
week_end
...
...
@@ -114,12 +115,26 @@ def group_week(request: HttpRequest, week: Optional[int] = None) -> HttpResponse
Q
(
lesson__groups__pk
=
int
(
request
.
GET
[
'
group
'
]))
|
Q
(
lesson__groups__parent_groups__pk
=
int
(
request
.
GET
[
'
group
'
]))
)
# Aggregate all personal notes for this group and week
persons
=
Person
.
objects
.
filter
(
is_active
=
True
).
filter
(
Q
(
member_of
=
group
)
|
Q
(
member_of__parent_groups
=
group
)
).
prefetch_related
(
'
personal_notes
'
).
annotate
(
absences
=
Count
(
'
personal_notes__absent
'
,
filter
=
Q
(
week
=
wanted_week
,
absent
=
True
)),
unexcused
=
Count
(
'
personal_notes__absent
'
,
filter
=
Q
(
week
=
wanted_week
,
absent
=
True
,
excused
=
False
)),
tardiness
=
Sum
(
'
personal_notes__tardiness
'
,
filter
=
Q
(
week
=
wanted_week
))
)
# Add a form to filter the view
select_form
=
SelectForm
(
request
.
GET
or
None
)
context
[
'
week
'
]
=
wanted_week
context
[
'
group
'
]
=
group
context
[
'
lesson_periods
'
]
=
lesson_periods
context
[
'
persons
'
]
=
persons
context
[
'
select_form
'
]
=
select_form
return
render
(
request
,
'
alsijil/group_week.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