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
393f8a74
Verified
Commit
393f8a74
authored
5 years ago
by
Nik | Klampfradler
Browse files
Options
Downloads
Patches
Plain Diff
Add view for register printing. Advances
#26
.
parent
716a1e8a
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
biscuit/apps/alsijil/urls.py
+2
-0
2 additions, 0 deletions
biscuit/apps/alsijil/urls.py
biscuit/apps/alsijil/views.py
+50
-1
50 additions, 1 deletion
biscuit/apps/alsijil/views.py
with
52 additions
and
1 deletion
biscuit/apps/alsijil/urls.py
+
2
−
0
View file @
393f8a74
...
...
@@ -10,4 +10,6 @@ urlpatterns = [
path
(
'
group/week
'
,
views
.
group_week
,
name
=
'
group_week
'
),
path
(
'
group/week/<int:year>/<int:week>
'
,
views
.
group_week
,
name
=
'
group_week_by_week
'
),
path
(
'
print/group/<int:id_>
'
,
views
.
full_register_group
,
name
=
'
full_register_group
'
)
]
This diff is collapsed.
Click to expand it.
biscuit/apps/alsijil/views.py
+
50
−
1
View file @
393f8a74
...
...
@@ -5,7 +5,7 @@ from typing import Optional
from
django.contrib.auth.decorators
import
login_required
from
django.db.models
import
Count
,
Exists
,
F
,
OuterRef
,
Q
,
Sum
from
django.http
import
Http404
,
HttpRequest
,
HttpResponse
from
django.shortcuts
import
render
from
django.shortcuts
import
get_object_or_404
,
render
from
django.urls
import
reverse
from
django.utils.translation
import
ugettext
as
_
from
django.views.decorators.cache
import
cache_page
...
...
@@ -169,3 +169,52 @@ def group_week(request: HttpRequest, year: Optional[int] = None, week: Optional[
return
render
(
request
,
'
alsijil/group_week.html
'
,
context
)
@login_required
def
full_register_group
(
request
:
HttpRequest
,
id_
:
int
)
->
HttpResponse
:
context
=
{}
group
=
get_object_or_404
(
Group
,
pk
=
id_
)
# Get all lesson periods for the selected group
lesson_periods
=
LessonPeriod
.
objects
.
annotate
(
has_documentation
=
Exists
(
LessonDocumentation
.
objects
.
filter
(
~
Q
(
topic__exact
=
''
),
lesson_period
=
OuterRef
(
'
pk
'
),
))
).
select_related
(
'
lesson
'
,
'
lesson__subject
'
,
'
period
'
,
'
room
'
).
prefetch_related
(
'
lesson__groups
'
,
'
lesson__teachers
'
,
'
substitutions
'
).
filter
(
Q
(
lesson__groups
=
group
)
|
Q
(
lesson__groups__parent_groups
=
group
)
).
distinct
()
# 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
)
).
distinct
().
prefetch_related
(
'
personal_notes
'
).
annotate
(
absences
=
Count
(
'
personal_notes__absent
'
,
filter
=
Q
(
personal_notes__lesson_period__in
=
lesson_periods
,
personal_notes__absent
=
True
)),
unexcused
=
Count
(
'
personal_notes__absent
'
,
filter
=
Q
(
personal_notes__lesson_period__in
=
lesson_periods
,
personal_notes__absent
=
True
,
personal_notes__excused
=
False
)),
tardiness
=
Sum
(
'
personal_notes__late
'
,
filter
=
Q
(
personal_notes__lesson_period__in
=
lesson_periods
,
))
)
context
[
'
group
'
]
=
group
context
[
'
lesson_periods
'
]
=
lesson_periods
context
[
'
persons
'
]
=
persons
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