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
c38aa61c
Commit
c38aa61c
authored
6 years ago
by
Jonathan Weth
Browse files
Options
Downloads
Patches
Plain Diff
Correct rooms in substitutions
parent
5f0fe9cb
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
biscuit/apps/untis/parse.py
+33
-8
33 additions, 8 deletions
biscuit/apps/untis/parse.py
biscuit/apps/untis/sub.py
+9
-5
9 additions, 5 deletions
biscuit/apps/untis/sub.py
with
42 additions
and
13 deletions
biscuit/apps/untis/parse.py
+
33
−
8
View file @
c38aa61c
...
...
@@ -57,7 +57,7 @@ class Lesson(object):
# print(rld2)
for
el
in
rld2
:
for
i
,
el
in
enumerate
(
rld2
)
:
teacher_id
=
int
(
el
[
0
])
subject_id
=
int
(
el
[
2
])
room_ids
=
untis_split_third
(
el
[
4
],
int
)
...
...
@@ -75,10 +75,14 @@ class Lesson(object):
else
:
subject
=
None
# rooms = self.times[i].rooms[i]
# for room_id in room_ids:
# r = drive["rooms"][room_id]
# rooms.append(r)
rooms
=
[]
for
room
_id
in
room
_id
s
:
r
=
drive
[
"
rooms
"
][
room_id
]
rooms
.
append
(
r
)
for
room
in
rooms
:
print
(
room
)
print
(
"
--
"
)
classes
=
[]
for
class_id
in
class_ids
:
...
...
@@ -211,17 +215,38 @@ def get_lesson_by_id(id):
return
lesson
def
get_lesson_element_by_id_and_teacher
(
lesson_id
,
teacher
):
def
get_lesson_element_by_id_and_teacher
(
lesson_id
,
teacher
,
hour
=
None
,
weekday
=
None
):
print
(
lesson_id
)
print
(
hour
,
"
LEWE
"
,
weekday
)
try
:
lesson
=
get_lesson_by_id
(
lesson_id
)
except
Exception
:
return
None
for
element
in
lesson
.
elements
:
el
=
None
i
=
0
print
(
lesson
.
elements
)
for
i
,
element
in
enumerate
(
lesson
.
elements
):
print
(
element
.
teacher
.
shortcode
)
if
element
.
teacher
.
id
==
teacher
.
id
:
return
element
return
None
el
=
element
break
t
=
None
print
(
lesson
.
times
)
print
(
weekday
)
print
(
hour
)
for
time
in
lesson
.
times
:
print
(
"
DAY
"
,
time
.
day
,
time
.
hour
)
if
time
.
day
==
weekday
and
time
.
hour
==
hour
:
t
=
time
print
(
t
)
room
=
None
if
t
is
not
None
:
room
=
t
.
rooms
[
i
]
if
el
is
not
None
:
return
el
,
room
return
None
,
None
def
parse_lesson_times
():
times
=
[]
...
...
This diff is collapsed.
Click to expand it.
biscuit/apps/untis/sub.py
+
9
−
5
View file @
c38aa61c
...
...
@@ -53,6 +53,7 @@ class Substitution(object):
self
.
corridor
=
None
self
.
classes
=
None
self
.
lesson_element
=
None
self
.
lesson_time
=
None
def
__str__
(
self
):
if
self
.
filled
:
...
...
@@ -81,9 +82,11 @@ class Substitution(object):
if
self
.
teacher_old
is
not
None
and
self
.
teacher_new
.
id
==
self
.
teacher_old
.
id
:
self
.
teacher_new
=
None
self
.
lesson_element
=
get_lesson_element_by_id_and_teacher
(
self
.
lesson_id
,
self
.
teacher_old
)
self
.
lesson_element
,
self
.
room_old
=
get_lesson_element_by_id_and_teacher
(
self
.
lesson_id
,
self
.
teacher_old
,
self
.
lesson
,
self
.
date
.
weekday
()
+
1
)
# print(self.lesson)
print
(
self
.
room_old
)
# Subject
self
.
subject_old
=
self
.
lesson_element
.
subject
if
self
.
lesson_element
is
not
None
else
None
if
db_obj
.
subject_idsubst
!=
0
:
...
...
@@ -93,9 +96,9 @@ class Substitution(object):
self
.
subject_new
=
None
# Room
self
.
rooms_old
=
self
.
lesson_element
.
rooms
if
self
.
lesson_element
is
not
None
else
[]
if
len
(
self
.
rooms_old
)
>=
1
:
self
.
room_old
=
self
.
rooms_old
[
0
]
#
self.rooms_old = self.lesson_element.rooms if self.lesson_element is not None else []
#
if len(self.rooms_old) >= 1:
#
self.room_old = self.rooms_old[0]
if
db_obj
.
room_idsubst
!=
0
:
self
.
room_new
=
drive
[
"
rooms
"
][
db_obj
.
room_idsubst
]
...
...
@@ -120,6 +123,7 @@ class Substitution(object):
self
.
classes
.
append
(
drive
[
"
classes
"
][
id
])
print
(
self
.
classes
)
def
substitutions_sorter
(
sub
):
# First, sort by class
sort_by
=
""
.
join
(
class_
.
name
for
class_
in
sub
.
classes
)
...
...
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