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
fbbf6766
Unverified
Commit
fbbf6766
authored
5 years ago
by
Nik | Klampfradler
Browse files
Options
Downloads
Patches
Plain Diff
Partially fix group week view.
parent
b5490863
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/templates/alsijil/group_week.html
+4
-10
4 additions, 10 deletions
biscuit/apps/alsijil/templates/alsijil/group_week.html
biscuit/apps/alsijil/views.py
+8
-13
8 additions, 13 deletions
biscuit/apps/alsijil/views.py
with
12 additions
and
23 deletions
biscuit/apps/alsijil/templates/alsijil/group_week.html
+
4
−
10
View file @
fbbf6766
...
...
@@ -18,28 +18,22 @@
{{ group.name }}
</div>
<div
class=
"card-body"
>
{% regroup lesson_periods by period.weekday_display as periods_by_day %}
{% for weekday, periods in periods_by_day %}
{% for weekday, periods in periods_by_day.items %}
<table
class=
"table table-striped table-bordered table-hover table-responsive-xl"
>
<caption>
{{ weekday }}
</caption>
<thead>
<tr>
<th>
{% blocktrans %}Period{% endblocktrans %}
</th>
<th>
{% blocktrans %}Subject{% endblocktrans %}
</th>
<th>
{% blocktrans %}Teachers{% endblocktrans %}
</th>
<th>
{% blocktrans %}Topic{% endblocktrans %}
</th>
</tr>
</thead>
<tbody>
{% for period in periods %}
<tr>
<td>
{{ period.period.period }}
</td>
<td>
{{ lesson.subject.name }}
</td>
<td>
{{ lesson.teachers|join:', ' }}
</td>
<td>
{% if period.documentations__count %}
{% fa 'fa-check' %}
{% endif}
</td>
<td>
{{ period.lesson.subject.name }}
</td>
<td>
{{ period.lesson.teachers|join:', ' }}
</td>
</tr>
{% endfor %}
</tbody>
...
...
This diff is collapsed.
Click to expand it.
biscuit/apps/alsijil/views.py
+
8
−
13
View file @
fbbf6766
...
...
@@ -7,7 +7,8 @@ from django.shortcuts import render
from
django.utils.translation
import
ugettext
as
_
from
biscuit.apps.chronos.models
import
Lesson
,
LessonPeriod
from
biscuit.apps.chronos.util
import
current_lesson_periods
,
current_week
from
biscuit.apps.chronos.util
import
current_lesson_periods
,
current_week
,
week_days
from
biscuit.core.models
import
Group
from
.forms
import
LessonDocumentationForm
,
PersonalNoteFormSet
from
.models
import
LessonDocumentation
,
PersonalNote
...
...
@@ -69,9 +70,9 @@ def group_week(request: HttpRequest, week: Optional[int] = None) -> HttpResponse
week_start
=
week_days
(
wanted_week
)[
0
]
week_end
=
week_days
(
wanted_week
)[
-
1
]
if
request
.
GET
.
get
(
'
group
_id
'
,
None
):
if
request
.
GET
.
get
(
'
group
'
,
None
):
# Use requested group
group
=
Group
.
objects
.
get
(
pk
=
request
.
GET
[
'
group
_id
'
])
group
=
Group
.
objects
.
get
(
pk
=
request
.
GET
[
'
group
'
])
elif
hasattr
(
request
,
'
user
'
)
and
hasattr
(
request
.
user
,
'
person
'
):
# Try to select group from owned groups of user
group
=
request
.
user
.
person
.
owner_of
.
first
()
...
...
@@ -80,20 +81,14 @@ def group_week(request: HttpRequest, week: Optional[int] = None) -> HttpResponse
lesson_periods
=
LessonPeriod
.
objects
.
none
()
periods_by_day
=
{}
if
group
:
for
lesson
in
group
.
lessons
.
filter
(
date_start__lte
=
week_start
,
date_end__gte
=
week_end
):
qs
=
lesson
.
periods
# Get number of filled-in documentations
qs
.
annotate
(
Count
(
'
documentations
'
,
filter
=
Q
(
documentations__week
=
wanted_week
,
documentations__topic__regex
=
r
'
.+
'
)))
# Combine the lesson periods of all lessons
lesson_periods
=
lesson
.
periods
.
union
(
lesson_periods
)
for
lesson_period
in
lesson
.
lesson_periods
.
all
():
periods_by_day
.
setdefault
(
lesson_period
.
period
.
get_weekday_display
(),
[]).
append
(
lesson_period
)
context
[
'
week
'
]
=
wanted_week
context
[
'
group
'
]
=
group
context
[
'
lesson_periods
'
]
=
lesson_periods
context
[
'
periods_by_day
'
]
=
periods_by_day
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