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

Add option to skip incomplete substitutions

parent 15d41524
No related branches found
No related tags found
1 merge request!119Resolve "Option to hide incomplete substitutions from the plan"
Pipeline #53514 passed
......@@ -9,6 +9,11 @@ and this project adheres to `Semantic Versioning`_.
Unreleased
----------
Changed
~~~~~~~
* Do not import incomplete substitutions.
`2.1.1`_ - 2022-01-29
---------------------
......
......@@ -89,3 +89,11 @@ class UseCourseGroups(BooleanPreference):
help_text = _(
"Build or search course groups for every course" " instead of setting classes as groups."
)
@site_preferences_registry.register
class IgnoreIncompleteSubstitutions(BooleanPreference):
section = untis_mysql
name = "ignore_incomplete_substitutions"
default = True
verbose_name = _("Ignore incomplete substitutions")
......@@ -8,6 +8,7 @@ from tqdm import tqdm
from aleksis.apps.chronos import models as chronos_models
from aleksis.apps.chronos.models import ValidityRange
from aleksis.core.util.core_helpers import get_site_preferences
from .... import models as mysql_models
from ..util import (
......@@ -138,6 +139,17 @@ def import_substitutions(
for id_ in class_ids:
classes.append(classes_ref[id_])
if get_site_preferences()["untis_mysql__ignore_incomplete_substitutions"]:
# Skip incomplete substitutions
if (
not room_new
and not subject_new
and not teachers
and not cancelled
and not cancelled_for_teachers
):
continue
if lesson_period:
(substitution, created,) = chronos_models.LessonSubstitution.objects.get_or_create(
lesson_period=lesson_period, week=week.week, year=week.year
......
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