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
b2f2c7d2
Verified
Commit
b2f2c7d2
authored
4 years ago
by
Jonathan Weth
Browse files
Options
Downloads
Patches
Plain Diff
Add data check to ensure that there are no excuses without absences
parent
25067f6e
No related branches found
No related tags found
Loading
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
aleksis/apps/alsijil/data_checks.py
+29
-0
29 additions, 0 deletions
aleksis/apps/alsijil/data_checks.py
with
29 additions
and
0 deletions
aleksis/apps/alsijil/data_checks.py
+
29
−
0
View file @
b2f2c7d2
...
@@ -168,3 +168,32 @@ class PersonalNoteOnHolidaysDataCheck(DataCheck):
...
@@ -168,3 +168,32 @@ class PersonalNoteOnHolidaysDataCheck(DataCheck):
result
=
DataCheckResult
.
objects
.
get_or_create
(
result
=
DataCheckResult
.
objects
.
get_or_create
(
check
=
cls
.
name
,
content_type
=
ct
,
object_id
=
note
.
id
check
=
cls
.
name
,
content_type
=
ct
,
object_id
=
note
.
id
)
)
@DATA_CHECK_REGISTRY.register
class
ExcusesWithoutAbsences
(
DataCheck
):
name
=
"
excuses_without_absences
"
verbose_name
=
_
(
"
Ensure that there are no excused personal notes without an absence
"
)
problem_name
=
_
(
"
The personal note is marked as excused, but not as absent.
"
)
solve_options
=
{
DeleteRelatedObjectSolveOption
.
name
:
DeleteRelatedObjectSolveOption
,
# FIXME OPTION
IgnoreSolveOption
.
name
:
IgnoreSolveOption
,
}
@classmethod
def
check_data
(
cls
):
from
aleksis.core.models
import
DataCheckResult
from
.models
import
PersonalNote
ct
=
ContentType
.
objects
.
get_for_model
(
PersonalNote
)
personal_notes
=
PersonalNote
.
objects
.
filter
(
excused
=
True
,
absent
=
False
)
for
note
in
personal_notes
:
logging
.
info
(
f
"
Check personal note
{
note
}
"
)
result
=
DataCheckResult
.
objects
.
get_or_create
(
check
=
cls
.
name
,
content_type
=
ct
,
object_id
=
note
.
id
)
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