Skip to content
Snippets Groups Projects
Commit 7519ac31 authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

Merge branch '39-option-to-hide-incomplete-substitutions-from-the-plan' into 'master'

Resolve "Option to hide incomplete substitutions from the plan"

Closes #39

See merge request AlekSIS/official/AlekSIS-App-Untis!119
parents 15d41524 377c12ff
No related branches found
No related tags found
1 merge request!119Resolve "Option to hide incomplete substitutions from the plan"
Pipeline #53515 failed
Pipeline: AlekSIS

#53521

    ...@@ -9,6 +9,11 @@ and this project adheres to `Semantic Versioning`_. ...@@ -9,6 +9,11 @@ and this project adheres to `Semantic Versioning`_.
    Unreleased Unreleased
    ---------- ----------
    Changed
    ~~~~~~~
    * Do not import incomplete substitutions.
    `2.1.1`_ - 2022-01-29 `2.1.1`_ - 2022-01-29
    --------------------- ---------------------
    ......
    ...@@ -89,3 +89,11 @@ class UseCourseGroups(BooleanPreference): ...@@ -89,3 +89,11 @@ class UseCourseGroups(BooleanPreference):
    help_text = _( help_text = _(
    "Build or search course groups for every course" " instead of setting classes as groups." "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 ...@@ -8,6 +8,7 @@ from tqdm import tqdm
    from aleksis.apps.chronos import models as chronos_models from aleksis.apps.chronos import models as chronos_models
    from aleksis.apps.chronos.models import ValidityRange from aleksis.apps.chronos.models import ValidityRange
    from aleksis.core.util.core_helpers import get_site_preferences
    from .... import models as mysql_models from .... import models as mysql_models
    from ..util import ( from ..util import (
    ...@@ -138,6 +139,17 @@ def import_substitutions( ...@@ -138,6 +139,17 @@ def import_substitutions(
    for id_ in class_ids: for id_ in class_ids:
    classes.append(classes_ref[id_]) 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: if lesson_period:
    (substitution, created,) = chronos_models.LessonSubstitution.objects.get_or_create( (substitution, created,) = chronos_models.LessonSubstitution.objects.get_or_create(
    lesson_period=lesson_period, week=week.week, year=week.year 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