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
f79aa476
Verified
Commit
f79aa476
authored
5 years ago
by
Tom Teichler
Browse files
Options
Downloads
Patches
Plain Diff
Rename starting_period to from_period.
parent
e1a521bd
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
biscuit/apps/alsijil/forms.py
+1
-1
1 addition, 1 deletion
biscuit/apps/alsijil/forms.py
biscuit/apps/alsijil/model_extensions.py
+3
-3
3 additions, 3 deletions
biscuit/apps/alsijil/model_extensions.py
biscuit/apps/alsijil/views.py
+3
-3
3 additions, 3 deletions
biscuit/apps/alsijil/views.py
with
7 additions
and
7 deletions
biscuit/apps/alsijil/forms.py
+
1
−
1
View file @
f79aa476
...
...
@@ -53,7 +53,7 @@ PersonalNoteFormSet = forms.modelformset_factory(
class
RegisterAbsenceForm
(
forms
.
Form
):
date_start
=
forms
.
DateField
(
label
=
_
(
'
Start date
'
),
widget
=
forms
.
SelectDateWidget
,
initial
=
datetime
.
today
)
date_end
=
forms
.
DateField
(
label
=
_
(
'
End date
'
),
widget
=
forms
.
SelectDateWidget
,
initial
=
datetime
.
today
)
starting_lesson
=
forms
.
IntegerField
(
label
=
_
(
'
Starting lesson
'
),
initial
=
0
,
min_value
=
0
)
from_period
=
forms
.
IntegerField
(
label
=
_
(
'
From period
'
),
initial
=
0
,
min_value
=
0
)
person
=
forms
.
ModelChoiceField
(
label
=
_
(
'
Person
'
),
queryset
=
Person
.
objects
.
all
(),
widget
=
Select2Widget
)
absent
=
forms
.
BooleanField
(
label
=
_
(
'
Absent
'
),
initial
=
True
,
required
=
False
)
excused
=
forms
.
BooleanField
(
label
=
_
(
'
Excused
'
),
initial
=
True
,
required
=
False
)
...
...
This diff is collapsed.
Click to expand it.
biscuit/apps/alsijil/model_extensions.py
+
3
−
3
View file @
f79aa476
f
rom
datetime
import
date
F
rom
datetime
import
date
from
django.db.models
import
Exists
,
F
,
OuterRef
...
...
@@ -10,7 +10,7 @@ from .models import PersonalNote
@Person.method
def
mark_absent
(
self
,
day
:
date
,
starting
_period
:
int
=
0
,
absent
:
bool
=
True
,
bool
=
False
,
remarks
:
str
=
''
):
def
mark_absent
(
self
,
day
:
date
,
from
_period
:
int
=
0
,
absent
:
bool
=
True
,
bool
=
False
,
remarks
:
str
=
''
):
"""
Mark a person absent for all lessons in a day, optionally starting with
a selected period number.
...
...
@@ -30,7 +30,7 @@ def mark_absent(self, day: date, starting_period: int = 0, absent: bool = True,
lesson_periods
=
self
.
lesson_periods_as_participant
.
on_day
(
day
).
filter
(
period__period__gte
=
starting
_period
period__period__gte
=
from
_period
)
# Create and update all personal notes for the discovered lesson periods
...
...
This diff is collapsed.
Click to expand it.
biscuit/apps/alsijil/views.py
+
3
−
3
View file @
f79aa476
...
...
@@ -232,7 +232,7 @@ def register_absence(request: HttpRequest) -> HttpResponse:
person
=
register_absence_form
.
cleaned_data
[
'
person
'
]
start_date
=
register_absence_form
.
cleaned_data
[
'
date_start
'
]
end_date
=
register_absence_form
.
cleaned_data
[
'
date_end
'
]
starting_lesson
=
register_absence_form
.
cleaned_data
[
'
starting_lesson
'
]
from_period
=
register_absence_form
.
cleaned_data
[
'
from_period
'
]
absent
=
register_absence_form
.
cleaned_data
[
'
absent
'
]
excused
=
register_absence_form
.
cleaned_data
[
'
excused
'
]
remarks
=
register_absence_form
.
cleaned_data
[
'
remarks
'
]
...
...
@@ -240,9 +240,9 @@ def register_absence(request: HttpRequest) -> HttpResponse:
# Mark person as absent
delta
=
end_date
-
start_date
for
i
in
range
(
delta
.
days
+
1
):
starting
_period
=
starting_lesson
if
i
==
0
else
0
from
_period
=
from_period
if
i
==
0
else
0
day
=
start_date
+
timedelta
(
days
=
i
)
person
.
mark_absent
(
day
,
starting
_period
,
absent
,
excused
,
remarks
)
person
.
mark_absent
(
day
,
from
_period
,
absent
,
excused
,
remarks
)
messages
.
success
(
request
,
_
(
'
The absence has been saved.
'
))
return
redirect
(
'
index
'
)
...
...
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