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
b7605ee6
Verified
Commit
b7605ee6
authored
4 years ago
by
Jonathan Weth
Browse files
Options
Downloads
Patches
Plain Diff
[Full register] Filter data by school term
parent
4a5b813e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!71
Resolve "[Full register] Filter personal notes by school term"
Pipeline
#3100
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
+26
-24
26 additions, 24 deletions
...s/apps/alsijil/templates/alsijil/print/full_register.html
aleksis/apps/alsijil/views.py
+30
-8
30 additions, 8 deletions
aleksis/apps/alsijil/views.py
with
56 additions
and
32 deletions
aleksis/apps/alsijil/templates/alsijil/print/full_register.html
+
26
−
24
View file @
b7605ee6
...
@@ -310,32 +310,34 @@
...
@@ -310,32 +310,34 @@
<tbody>
<tbody>
{% for note in person.personal_notes.all %}
{% for note in person.personal_notes.all %}
{% if note.absent or note.late or note.remarks %}
{% if note.lesson_period in lesson_periods or note.lesson_period in lesson_periods %}
{% period_to_date note.week note.lesson_period.period as note_date %}
{% if note.absent or note.late or note.remarks %}
<tr>
{% period_to_date note.week note.lesson_period.period as note_date %}
<td>
{{ note_date }}
</td>
<tr>
<td>
{{ note.lesson_period.period.period }}
</td>
<td>
{{ note_date }}
</td>
<td>
{{ note.lesson_period.get_subject.short_name }}
</td>
<td>
{{ note.lesson_period.period.period }}
</td>
<td>
{{ note.lesson_period.get_teachers.first.short_name }}
</td>
<td>
{{ note.lesson_period.get_subject.short_name }}
</td>
<td>
<td>
{{ note.lesson_period.get_teachers.first.short_name }}
</td>
{% if note.absent %}
<td>
{% trans 'Yes' %}
{% if note.absent %}
{% if note.excused %}
{% trans 'Yes' %}
{% if note.excuse_type %}
{% if note.excused %}
({{ note.excuse_type.short_name }})
{% if note.excuse_type %}
{% else %}
({{ note.excuse_type.short_name }})
({% trans 'e' %})
{% else %}
({% trans 'e' %})
{% endif %}
{% endif %}
{% endif %}
{% endif %}
{% endif %}
{% endif %}
</td>
<
/
td>
<td>
<td>
{% if note.late %}
{% if
note.late
%
}
{{
note.late }
}'
{
{ note.late }}'
{
% endif %}
{% endif %}
</td>
</td>
<td>
{{ note.remarks }}
</td>
<td>
{{ note.remarks }}
</t
d
>
</t
r
>
</tr>
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
{% endfor %}
</tbody>
</tbody>
...
...
This diff is collapsed.
Click to expand it.
aleksis/apps/alsijil/views.py
+
30
−
8
View file @
b7605ee6
...
@@ -16,6 +16,7 @@ from rules.contrib.views import PermissionRequiredMixin
...
@@ -16,6 +16,7 @@ from rules.contrib.views import PermissionRequiredMixin
from
aleksis.apps.chronos.managers
import
TimetableType
from
aleksis.apps.chronos.managers
import
TimetableType
from
aleksis.apps.chronos.models
import
LessonPeriod
from
aleksis.apps.chronos.models
import
LessonPeriod
from
aleksis.apps.chronos.util.chronos_helpers
import
get_el_by_pk
from
aleksis.apps.chronos.util.chronos_helpers
import
get_el_by_pk
from
aleksis.apps.chronos.util.date
import
week_weekday_to_date
from
aleksis.core.mixins
import
AdvancedCreateView
,
AdvancedDeleteView
,
AdvancedEditView
from
aleksis.core.mixins
import
AdvancedCreateView
,
AdvancedDeleteView
,
AdvancedEditView
from
aleksis.core.models
import
Group
,
Person
,
SchoolTerm
from
aleksis.core.models
import
Group
,
Person
,
SchoolTerm
from
aleksis.core.util
import
messages
from
aleksis.core.util
import
messages
...
@@ -46,6 +47,14 @@ def lesson(
...
@@ -46,6 +47,14 @@ def lesson(
lesson_period
=
LessonPeriod
.
objects
.
annotate_week
(
wanted_week
).
get
(
lesson_period
=
LessonPeriod
.
objects
.
annotate_week
(
wanted_week
).
get
(
pk
=
period_id
pk
=
period_id
)
)
date_of_lesson
=
week_weekday_to_date
(
wanted_week
,
lesson_period
.
period
.
weekday
)
if
(
date_of_lesson
<
lesson_period
.
lesson
.
validity
.
date_start
or
date_of_lesson
>
lesson_period
.
lesson
.
validity
.
date_end
):
return
HttpResponseNotFound
()
else
:
else
:
# Determine current lesson by current date and time
# Determine current lesson by current date and time
lesson_period
=
(
lesson_period
=
(
...
@@ -290,18 +299,19 @@ def full_register_group(request: HttpRequest, id_: int) -> HttpResponse:
...
@@ -290,18 +299,19 @@ def full_register_group(request: HttpRequest, id_: int) -> HttpResponse:
group
=
get_object_or_404
(
Group
,
pk
=
id_
)
group
=
get_object_or_404
(
Group
,
pk
=
id_
)
current_school_term
=
SchoolTerm
.
current
if
not
current_school_term
:
return
HttpResponseNotFound
(
_
(
"
There is no current school term.
"
))
# Get all lesson periods for the selected group
# Get all lesson periods for the selected group
lesson_periods
=
(
lesson_periods
=
(
LessonPeriod
.
objects
.
filter_group
(
group
)
LessonPeriod
.
objects
.
filter_group
(
group
)
.
filter
(
lesson__validity__school_term
=
current_school_term
)
.
distinct
()
.
distinct
()
.
prefetch_related
(
"
documentations
"
,
"
personal_notes
"
)
.
prefetch_related
(
"
documentations
"
,
"
personal_notes
"
)
)
)
current_school_term
=
SchoolTerm
.
current
if
not
current_school_term
:
return
HttpResponseNotFound
(
_
(
"
There is no current school term.
"
))
weeks
=
CalendarWeek
.
weeks_within
(
weeks
=
CalendarWeek
.
weeks_within
(
current_school_term
.
date_start
,
current_school_term
.
date_end
,
current_school_term
.
date_start
,
current_school_term
.
date_end
,
)
)
...
@@ -336,7 +346,11 @@ def full_register_group(request: HttpRequest, id_: int) -> HttpResponse:
...
@@ -336,7 +346,11 @@ def full_register_group(request: HttpRequest, id_: int) -> HttpResponse:
persons
=
group
.
members
.
annotate
(
persons
=
group
.
members
.
annotate
(
absences_count
=
Count
(
absences_count
=
Count
(
"
personal_notes__absent
"
,
filter
=
Q
(
personal_notes__absent
=
True
)
"
personal_notes__absent
"
,
filter
=
Q
(
personal_notes__absent
=
True
,
personal_notes__lesson_period__lesson__validity__school_term
=
current_school_term
,
),
),
),
excused
=
Count
(
excused
=
Count
(
"
personal_notes__absent
"
,
"
personal_notes__absent
"
,
...
@@ -344,11 +358,16 @@ def full_register_group(request: HttpRequest, id_: int) -> HttpResponse:
...
@@ -344,11 +358,16 @@ def full_register_group(request: HttpRequest, id_: int) -> HttpResponse:
personal_notes__absent
=
True
,
personal_notes__absent
=
True
,
personal_notes__excused
=
True
,
personal_notes__excused
=
True
,
personal_notes__excuse_type__isnull
=
True
,
personal_notes__excuse_type__isnull
=
True
,
personal_notes__lesson_period__lesson__validity__school_term
=
current_school_term
,
),
),
),
),
unexcused
=
Count
(
unexcused
=
Count
(
"
personal_notes__absent
"
,
"
personal_notes__absent
"
,
filter
=
Q
(
personal_notes__absent
=
True
,
personal_notes__excused
=
False
),
filter
=
Q
(
personal_notes__absent
=
True
,
personal_notes__excused
=
False
,
personal_notes__lesson_period__lesson__validity__school_term
=
current_school_term
,
),
),
),
tardiness
=
Sum
(
"
personal_notes__late
"
),
tardiness
=
Sum
(
"
personal_notes__late
"
),
)
)
...
@@ -361,6 +380,7 @@ def full_register_group(request: HttpRequest, id_: int) -> HttpResponse:
...
@@ -361,6 +380,7 @@ def full_register_group(request: HttpRequest, id_: int) -> HttpResponse:
filter
=
Q
(
filter
=
Q
(
personal_notes__absent
=
True
,
personal_notes__absent
=
True
,
personal_notes__excuse_type
=
excuse_type
,
personal_notes__excuse_type
=
excuse_type
,
personal_notes__lesson_period__lesson__validity__school_term
=
current_school_term
,
),
),
)
)
}
}
...
@@ -375,7 +395,8 @@ def full_register_group(request: HttpRequest, id_: int) -> HttpResponse:
...
@@ -375,7 +395,8 @@ def full_register_group(request: HttpRequest, id_: int) -> HttpResponse:
%
personal_note_filter
.
identifier
:
Count
(
%
personal_note_filter
.
identifier
:
Count
(
"
personal_notes__remarks
"
,
"
personal_notes__remarks
"
,
filter
=
Q
(
filter
=
Q
(
personal_notes__remarks__iregex
=
personal_note_filter
.
regex
personal_notes__remarks__iregex
=
personal_note_filter
.
regex
,
personal_notes__lesson_period__lesson__validity__school_term
=
current_school_term
,
),
),
)
)
}
}
...
@@ -388,6 +409,7 @@ def full_register_group(request: HttpRequest, id_: int) -> HttpResponse:
...
@@ -388,6 +409,7 @@ def full_register_group(request: HttpRequest, id_: int) -> HttpResponse:
context
[
"
group
"
]
=
group
context
[
"
group
"
]
=
group
context
[
"
weeks
"
]
=
weeks
context
[
"
weeks
"
]
=
weeks
context
[
"
periods_by_day
"
]
=
periods_by_day
context
[
"
periods_by_day
"
]
=
periods_by_day
context
[
"
lesson_periods
"
]
=
lesson_periods
context
[
"
today
"
]
=
date
.
today
()
context
[
"
today
"
]
=
date
.
today
()
return
render
(
request
,
"
alsijil/print/full_register.html
"
,
context
)
return
render
(
request
,
"
alsijil/print/full_register.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