Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor 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-Core
Commits
f451e637
Commit
f451e637
authored
6 years ago
by
Jonathan Weth
Browse files
Options
Downloads
Patches
Plain Diff
Add cache (called drive) to substitutions | Add corridors to cache
parent
7b9e39f5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!86
Merge school-apps
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
schoolapps/untisconnect/parse.py
+7
-5
7 additions, 5 deletions
schoolapps/untisconnect/parse.py
schoolapps/untisconnect/sub.py
+10
-7
10 additions, 7 deletions
schoolapps/untisconnect/sub.py
with
17 additions
and
12 deletions
schoolapps/untisconnect/parse.py
+
7
−
5
View file @
f451e637
...
...
@@ -123,16 +123,18 @@ def build_drive():
"
teachers
"
:
get_all_teachers
(),
"
rooms
"
:
get_all_rooms
(),
"
classes
"
:
get_all_classes
(),
"
subjects
"
:
get_all_subjects
()
"
subjects
"
:
get_all_subjects
(),
"
corridors
"
:
get_all_corridors
(),
}
drive
=
{
"
teachers
"
:
{},
"
rooms
"
:
{},
"
classes
"
:
{},
"
subjects
"
:
{}
#
"teachers": {},
#
"rooms": {},
#
"classes": {},
#
"subjects": {}
}
for
key
,
value
in
odrive
.
items
():
drive
[
key
]
=
{}
for
el
in
value
:
id
=
el
.
id
drive
[
key
][
id
]
=
el
...
...
This diff is collapsed.
Click to expand it.
schoolapps/untisconnect/sub.py
+
10
−
7
View file @
f451e637
...
...
@@ -4,7 +4,7 @@ from untisconnect import models
from
untisconnect.api
import
run_default_filter
,
row_by_row_helper
,
get_teacher_by_id
,
get_subject_by_id
,
\
get_room_by_id
,
get_class_by_id
,
get_corridor_by_id
from
untisconnect.api_helper
import
run_using
,
untis_split_first
from
untisconnect.parse
import
get_lesson_by_id
,
get_lesson_element_by_id_and_teacher
from
untisconnect.parse
import
get_lesson_by_id
,
get_lesson_element_by_id_and_teacher
,
build_drive
DATE_FORMAT
=
"
%Y%m%d
"
...
...
@@ -32,6 +32,9 @@ def parse_type_of_untis_flags(flags):
return
type_
drive
=
build_drive
()
class
Substitution
(
object
):
def
__init__
(
self
):
self
.
filled
=
False
...
...
@@ -71,9 +74,9 @@ class Substitution(object):
# Teacher
# print(db_obj.teacher_idlessn)
if
db_obj
.
teacher_idlessn
!=
0
:
self
.
teacher_old
=
get_teacher_by_id
(
db_obj
.
teacher_idlessn
)
self
.
teacher_old
=
drive
[
"
teachers
"
][
db_obj
.
teacher_idlessn
]
if
db_obj
.
teacher_idsubst
!=
0
:
self
.
teacher_new
=
get_teacher_by_id
(
db_obj
.
teacher_idsubst
)
self
.
teacher_new
=
drive
[
"
teachers
"
][
db_obj
.
teacher_idsubst
]
if
self
.
teacher_old
is
not
None
and
self
.
teacher_new
.
id
==
self
.
teacher_old
.
id
:
self
.
teacher_new
=
None
...
...
@@ -84,7 +87,7 @@ class Substitution(object):
# Subject
self
.
subject_old
=
self
.
lesson_element
.
subject
if
self
.
lesson_element
is
not
None
else
None
if
db_obj
.
subject_idsubst
!=
0
:
self
.
subject_new
=
get_subject_by_id
(
db_obj
.
subject_idsubst
)
self
.
subject_new
=
drive
[
"
subjects
"
][
db_obj
.
subject_idsubst
]
if
self
.
subject_old
is
not
None
and
self
.
subject_old
.
id
==
self
.
subject_new
.
id
:
self
.
subject_new
=
None
...
...
@@ -95,7 +98,7 @@ class Substitution(object):
self
.
room_old
=
self
.
rooms_old
[
0
]
if
db_obj
.
room_idsubst
!=
0
:
self
.
room_new
=
get_room_by_id
(
db_obj
.
room_idsubst
)
self
.
room_new
=
drive
[
"
rooms
"
][
db_obj
.
room_idsubst
]
if
self
.
room_old
is
not
None
and
self
.
room_old
.
id
==
self
.
room_new
.
id
:
self
.
room_new
=
None
...
...
@@ -105,7 +108,7 @@ class Substitution(object):
# print("CORRIDOR")
# print(self.corridor)
if
db_obj
.
corridor_id
!=
0
:
self
.
corridor
=
get_
corridor
_by_id
(
db_obj
.
corridor_id
)
self
.
corridor
=
drive
[
"
corridor
s
"
][
db_obj
.
corridor_id
]
self
.
type
=
TYPE_CORRIDOR
# Classes
...
...
@@ -113,7 +116,7 @@ class Substitution(object):
class_ids
=
untis_split_first
(
db_obj
.
classids
,
conv
=
int
)
# print(class_ids)
for
id
in
class_ids
:
self
.
classes
.
append
(
get_class_by_id
(
id
)
)
self
.
classes
.
append
(
drive
[
"
classes
"
][
id
]
)
def
substitutions_sorter
(
sub
):
...
...
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