Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-App-Untis
Manage
Activity
Members
Labels
Plan
Issues
12
Issue boards
Milestones
Wiki
Code
Merge requests
9
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AlekSIS®
Official
AlekSIS-App-Untis
Commits
b4dd1ad5
Verified
Commit
b4dd1ad5
authored
2 years ago
by
Jonathan Weth
Browse files
Options
Downloads
Patches
Plain Diff
Use teachers only as fallback match for course groups
parent
6e377815
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!154
Resolve "Use teachers only as fallback for course group matching"
Pipeline
#85477
passed with stages
in 11 minutes and 39 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aleksis/apps/untis/util/mysql/importers/absences.py
+1
-0
1 addition, 0 deletions
aleksis/apps/untis/util/mysql/importers/absences.py
aleksis/apps/untis/util/mysql/importers/lessons.py
+25
-22
25 additions, 22 deletions
aleksis/apps/untis/util/mysql/importers/lessons.py
with
26 additions
and
22 deletions
aleksis/apps/untis/util/mysql/importers/absences.py
+
1
−
0
View file @
b4dd1ad5
...
...
@@ -183,5 +183,6 @@ def import_absences(
if
a
.
import_ref_untis
and
a
.
import_ref_untis
not
in
existing_absences
:
logger
.
info
(
"
Absence {} deleted
"
.
format
(
a
.
id
))
a
.
delete
()
LessonSubstitution
.
objects
.
filter
(
absence_ref_untis
=
a
.
import_ref_untis
).
delete
()
return
ref
,
created_substitutions
This diff is collapsed.
Click to expand it.
aleksis/apps/untis/util/mysql/importers/lessons.py
+
25
−
22
View file @
b4dd1ad5
...
...
@@ -128,46 +128,49 @@ def import_lessons(
qs
=
core_models
.
Group
.
objects
.
filter
(
parent_groups__in
=
[
c
.
id
for
c
in
course_classes
],
subject_id
=
subject
.
id
,
owners__in
=
[
t
.
id
for
t
in
teachers
],
).
filter
(
Q
(
school_term__isnull
=
True
)
|
Q
(
school_term
=
validity_range
.
school_term
))
if
not
qs
.
exists
():
logger
.
warning
(
"
Not matching course group not found
"
)
# Check if found groups match
possible_groups
=
[]
course_group
=
None
for
found_group
in
qs
:
if
compare_m2m
(
course_classes
,
found_group
.
parent_groups
.
all
())
and
compare_m2m
(
teachers
,
found_group
.
owners
.
all
()
):
course_group
=
found_group
logger
.
info
(
"
Course group found by searching by parent groups,
"
"
teachers (owners) and subject
"
)
possible_groups
.
append
(
found_group
)
if
len
(
possible_groups
)
==
1
:
course_group
=
possible_groups
[
0
]
logger
.
info
(
"
Course group found by searching by parent groups, and subject
"
)
else
:
for
found_group
in
possible_groups
:
if
compare_m2m
(
teachers
,
found_group
.
owners
.
all
()):
course_group
=
found_group
logger
.
info
(
"
Course group found by searching by parent groups,
"
"
teachers (owners) and subject
"
)
if
(
not
course_group
and
get_site_preferences
()[
"
untis_mysql__course_groups_fuzzy_matching
"
]
):
qs
=
qs
.
filter
(
owners__in
=
[
t
.
id
for
t
in
teachers
])
if
qs
.
count
()
!=
1
:
logger
.
warning
(
"
Course group not found by searching by parent groups,
"
"
Course group not found or more than one found
"
"
by searching by parent groups,
"
"
teachers (owners) and subject (fuzzy matching mode)
"
)
else
:
for
found_group
in
qs
:
if
compare_m2m
(
teachers
,
found_group
.
owners
.
all
()):
if
course_group
:
logger
.
warning
(
"
More than one course group found
"
"
by searching by parent groups,
"
"
teachers (owners) and subject (fuzzy matching mode)
"
)
course_group
=
None
else
:
course_group
=
found_group
logger
.
info
(
"
Course group found by searching by parent groups,
"
"
teachers (owners) and subject (fuzzy matching mode)
"
)
course_group
=
qs
.
first
()
logger
.
info
(
"
Course group found by searching by parent groups,
"
"
teachers (owners) and subject (fuzzy matching mode)
"
)
changed
=
False
register_data_check
=
get_site_preferences
()[
...
...
This diff is collapsed.
Click to expand it.
Jonathan Weth
@hansegucker
mentioned in merge request
!157 (merged)
·
2 years ago
mentioned in merge request
!157 (merged)
mentioned in merge request !157
Toggle commit list
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment