Skip to content
Snippets Groups Projects
Verified Commit 3c99004a authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Add missing reset solve option for data checks

parent f42357a6
No related branches found
No related tags found
1 merge request!92Resolve "Add task for checking plausibility of data"
Pipeline #5007 failed
......@@ -32,6 +32,18 @@ class SetGroupsWithCurrentGroupsSolveOption(SolveOption):
check_result.delete()
class ResetPersonalNoteSolveOption(SolveOption):
name = "reset_personal_note"
verbose_name = _("Reset personal note to defaults")
@classmethod
def solve(cls, check_result: "DataCheckResult"):
note = check_result.related_object
note.reset_values()
note.save()
check_result.delete()
@DATA_CHECK_REGISTRY.register
class NoPersonalNotesInCancelledLessonsDataCheck(DataCheck):
name = "no_personal_notes_in_cancelled_lessons"
......@@ -175,8 +187,7 @@ class ExcusesWithoutAbsences(DataCheck):
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
ResetPersonalNoteSolveOption.name: ResetPersonalNoteSolveOption,
IgnoreSolveOption.name: IgnoreSolveOption,
}
......@@ -188,8 +199,7 @@ class ExcusesWithoutAbsences(DataCheck):
ct = ContentType.objects.get_for_model(PersonalNote)
personal_notes = PersonalNote.objects.filter(excused=True,
absent=False)
personal_notes = PersonalNote.objects.filter(excused=True, absent=False)
for note in personal_notes:
logging.info(f"Check personal note {note}")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment