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
bcf33900
Verified
Commit
bcf33900
authored
10 months ago
by
Jonathan Weth
Browse files
Options
Downloads
Patches
Plain Diff
Track whether participation has been filled already
parent
0c756e6f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!360
Resolve "Add absence management to course book student dialog"
Pipeline
#188704
failed
10 months ago
Stage: prepare
Stage: test
Stage: build
Stage: publish
Stage: docker
Changes
2
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aleksis/apps/alsijil/migrations/0022_documentation_participation_touched_at.py
+18
-0
18 additions, 0 deletions
...migrations/0022_documentation_participation_touched_at.py
aleksis/apps/alsijil/models.py
+12
-6
12 additions, 6 deletions
aleksis/apps/alsijil/models.py
with
30 additions
and
6 deletions
aleksis/apps/alsijil/migrations/0022_documentation_participation_touched_at.py
0 → 100644
+
18
−
0
View file @
bcf33900
# Generated by Django 5.0.6 on 2024-06-06 09:36
from
django.db
import
migrations
,
models
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'
alsijil
'
,
'
0021_remove_participationstatus_absent_and_more
'
),
]
operations
=
[
migrations
.
AddField
(
model_name
=
'
documentation
'
,
name
=
'
participation_touched_at
'
,
field
=
models
.
DateTimeField
(
blank
=
True
,
null
=
True
,
verbose_name
=
'
Participation touched at
'
),
),
]
This diff is collapsed.
Click to expand it.
aleksis/apps/alsijil/models.py
+
12
−
6
View file @
bcf33900
...
...
@@ -9,6 +9,7 @@ from django.db.models import QuerySet
from
django.db.models.constraints
import
CheckConstraint
from
django.db.models.query_utils
import
Q
from
django.urls
import
reverse
from
django.utils
import
timezone
from
django.utils.formats
import
date_format
from
django.utils.timezone
import
localdate
,
localtime
from
django.utils.translation
import
gettext_lazy
as
_
...
...
@@ -489,6 +490,11 @@ class Documentation(CalendarEvent):
homework
=
models
.
CharField
(
verbose_name
=
_
(
"
Homework
"
),
max_length
=
255
,
blank
=
True
)
group_note
=
models
.
CharField
(
verbose_name
=
_
(
"
Group Note
"
),
max_length
=
255
,
blank
=
True
)
# Used to track whether participations have been filled in
participation_touched_at
=
models
.
DateTimeField
(
blank
=
True
,
null
=
True
,
verbose_name
=
_
(
"
Participation touched at
"
)
)
def
get_subject
(
self
)
->
str
:
if
self
.
subject
:
return
self
.
subject
...
...
@@ -698,17 +704,13 @@ class Documentation(CalendarEvent):
"""
Ensure that participation statuses are created for this documentation.
"""
# TODO: Check for preexisting absences in kolego
if
not
self
.
amends
or
self
.
datetime_start
<=
localtime
():
# There is no source to update from or it's to early
if
self
.
participation_touched_at
or
not
self
.
amends
or
self
.
datetime_start
>
localtime
():
# There is no source to update from or it's to
o
early
return
lesson_event
:
LessonEvent
=
self
.
amends
all_members
=
lesson_event
.
all_members
existing_participations
=
ParticipationStatus
.
objects
.
filter
(
related_documentation
=
self
)
if
existing_participations
.
exists
():
return
new_persons
=
Person
.
objects
.
filter
(
Q
(
pk__in
=
[
p
.
pk
for
p
in
all_members
])).
prefetch_related
(
"
member_of
"
)
...
...
@@ -730,6 +732,10 @@ class Documentation(CalendarEvent):
]
new_participations
.
append
(
participation_status
)
ParticipationStatus
.
groups_of_person
.
through
.
objects
.
bulk_create
(
new_groups_of_person
)
self
.
participation_touched_at
=
timezone
.
now
()
self
.
save
()
return
new_participations
...
...
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