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