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

Merge branch '50-unboundlocalerror-local-variable-match-referenced-before-assignment' into 'master'

Resolve "UnboundLocalError: local variable 'match' referenced before assignment"

Closes #50

See merge request !139
parents 77fb042f c99f2869
No related branches found
Tags 2.2.1.dev0
1 merge request!139Resolve "UnboundLocalError: local variable 'match' referenced before assignment"
Pipeline #65467 passed with warnings
......@@ -12,6 +12,7 @@ Unreleased
Fixed
~~~~~
* Matching for groups while importing lessons was broken in some cases.
* Import commands `current_next` and `current_future` imported all terms.
`2.2`_ - 2022-04-10
......
......@@ -139,7 +139,6 @@ def import_lessons(
if compare_m2m(course_classes, found_group.parent_groups.all()) and compare_m2m(
teachers, found_group.owners.all()
):
match = True
course_group = found_group
logger.info(
" Course group found by searching by parent groups, "
......@@ -147,7 +146,7 @@ def import_lessons(
)
if (
not match
not course_group
and get_site_preferences()["untis_mysql__course_groups_fuzzy_matching"]
):
if qs.count() != 1:
......@@ -158,16 +157,14 @@ def import_lessons(
else:
for found_group in qs:
if compare_m2m(teachers, found_group.owners.all()):
if match:
if course_group:
logger.warning(
" More than one course group found "
"by searching by parent groups, "
"teachers (owners) and subject (fuzzy matching mode)"
)
match = False
course_group = None
else:
match = True
course_group = found_group
logger.info(
" Course group found by searching by parent groups, "
......
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