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

Merge branch 'master' into 41-create-match-failures-as-data-checks

parents 23cb5092 7519ac31
No related branches found
No related tags found
1 merge request!120Resolve "Create match failures as data checks"
Pipeline #53517 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
---------------------
......
......@@ -108,3 +108,10 @@ class CreateObjectsForWhichUntisIsNotPrimarySource(BooleanPreference):
name = "create_objects_untis_not_primary_source"
default = True
verbose_name = _("Create objects for which Untis is not primary source")
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