Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-App-Untis
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
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
f5e42804
Unverified
Commit
f5e42804
authored
5 years ago
by
Nik | Klampfradler
Browse files
Options
Downloads
Patches
Plain Diff
Fix imports.
parent
f14432e1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
biscuit/apps/untis/util.py
+10
-2
10 additions, 2 deletions
biscuit/apps/untis/util.py
with
10 additions
and
2 deletions
biscuit/apps/untis/util.py
+
10
−
2
View file @
f5e42804
from
datetime
import
date
,
time
from
xml.dom
import
minidom
from
django.contrib
import
messages
from
django.utils.translation
import
ugettext_lazy
as
_
from
biscuit.apps.cambro.models
import
Room
from
biscuit.apps.chronos.models
import
Subject
,
TimePeriod
,
Lesson
from
biscuit.core.models
import
Group
,
Person
...
...
@@ -63,7 +66,7 @@ def untis_import_xml(request, untis_xml):
subject_abbrev
=
get_child_node_id
(
lesson_node
,
'
lesson_subject
'
)[
3
:]
teacher_short_name
=
get_child_node_id
(
lesson_node
,
'
lesson_teacher
'
)[
3
:]
group_short_names
=
[
v
[
:
3
]
for
v
in
get_child_node_id
(
group_short_names
=
[
v
[
3
:
]
for
v
in
get_child_node_id
(
lesson_node
,
'
lesson_classes
'
).
split
(
'
'
)]
effectivebegindate
=
get_child_node_text
(
lesson_node
,
'
effectivebegindate
'
)
...
...
@@ -77,7 +80,6 @@ def untis_import_xml(request, untis_xml):
time_periods
.
append
((
day
,
period
))
subject
=
Subject
.
objects
.
get
(
abbrev
=
subject_abbrev
)
teachers
=
[
Person
.
objects
.
get
(
short_name
=
teacher_short_name
)]
groups
=
[
Group
.
objects
.
get
(
short_name
=
v
)
for
v
in
group_short_names
]
periods
=
[
TimePeriod
.
objects
.
get
(
weekday
=
v
[
0
],
period
=
v
[
1
])
for
v
in
time_periods
]
...
...
@@ -86,5 +88,11 @@ def untis_import_xml(request, untis_xml):
date_end
=
date
(
int
(
effectiveenddate
[:
4
]),
int
(
effectiveenddate
[
4
:
6
]),
int
(
effectiveenddate
[
6
:]))
if
effectiveenddate
else
None
try
:
teachers
=
[
Person
.
objects
.
get
(
short_name
=
teacher_short_name
)]
except
Person
.
DoesNotExist
:
messages
.
error
(
request
,
_
(
'
Failed to import lesson: Teacher %s does not exist.
'
)
%
teacher_short_name
)
lesson
,
created
=
Lesson
.
objects
.
get_or_create
(
groups
=
groups
,
periods
=
periods
,
defaults
=
{
'
subject
'
:
subject
,
'
teachers
'
:
teachers
,
'
date_start
'
:
date_start
,
'
date_end
'
:
date_end
})
This diff is collapsed.
Click to expand it.
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