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
34b3223b
Verified
Commit
34b3223b
authored
5 years ago
by
Jonathan Weth
Browse files
Options
Downloads
Patches
Plain Diff
Reformat main.py and util.py
parent
7e865773
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!13
Resolve "Support import from MySQL"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aleksis/apps/untis/util/mysql/main.py
+16
-14
16 additions, 14 deletions
aleksis/apps/untis/util/mysql/main.py
aleksis/apps/untis/util/mysql/util.py
+1
-1
1 addition, 1 deletion
aleksis/apps/untis/util/mysql/util.py
with
17 additions
and
15 deletions
aleksis/apps/untis/util/mysql/main.py
+
16
−
14
View file @
34b3223b
...
...
@@ -114,9 +114,9 @@ def untis_import_mysql():
# Classes
classes_ref
=
{}
classes
=
run_default_filter
(
mysql_models
.
Class
.
objects
,
filter_term
=
True
)
course_
classes
=
run_default_filter
(
mysql_models
.
Class
.
objects
,
filter_term
=
True
)
for
class_
in
classes
:
for
class_
in
course_
classes
:
if
not
class_
.
name
:
raise
Exception
(
"
Short name needed.
"
)
...
...
@@ -185,11 +185,11 @@ def untis_import_mysql():
# Time Periods
time_periods_ref
=
[]
periods
=
run_default_filter
(
mysql_models
.
Commondata
.
objects
,
filter_term
=
False
)
.
filter
(
id
=
40
# Fixed UNTIS constant
)
.
order_by
(
"
number
"
,
"
number1
"
)
periods
=
(
run_default_filter
(
mysql_models
.
Commondata
.
objects
,
filter_term
=
False
)
.
filter
(
id
=
40
)
# Fixed UNTIS constant
.
order_by
(
"
number
"
,
"
number1
"
)
)
for
time_period
in
periods
:
weekday
=
time_period
.
number
-
1
...
...
@@ -198,8 +198,9 @@ def untis_import_mysql():
end_time
=
time
(
time_period
.
fieldbyte3
,
time_period
.
fieldbyte4
)
new_time_period
,
created
=
chronos_models
.
TimePeriod
.
objects
.
get_or_create
(
weekday
=
weekday
,
period
=
period
,
defaults
=
{
"
time_start
"
:
start_time
,
"
time_end
"
:
end_time
}
weekday
=
weekday
,
period
=
period
,
defaults
=
{
"
time_start
"
:
start_time
,
"
time_end
"
:
end_time
},
)
new_time_period
.
time_start
=
start_time
...
...
@@ -224,15 +225,16 @@ def untis_import_mysql():
after_period
=
time_period
before_period
=
time_periods
[
i
+
1
]
short_name
=
"
{}: {}./{}.
"
.
format
(
weekday
,
after_period
.
period
if
after_period
else
"
-
"
,
before_period
.
period
if
before_period
else
"
-
"
)
short_name
=
"
{}: {}./{}.
"
.
format
(
weekday
,
after_period
.
period
if
after_period
else
"
-
"
,
before_period
.
period
if
before_period
else
"
-
"
,
)
new_break
,
created
=
chronos_models
.
Break
.
objects
.
get_or_create
(
after_period
=
after_period
,
before_period
=
before_period
,
defaults
=
{
"
short_name
"
:
short_name
,
"
name
"
:
short_name
}
defaults
=
{
"
short_name
"
:
short_name
,
"
name
"
:
short_name
},
)
# Lessons
...
...
This diff is collapsed.
Click to expand it.
aleksis/apps/untis/util/mysql/util.py
+
1
−
1
View file @
34b3223b
...
...
@@ -4,7 +4,7 @@ from datetime import date, datetime
def
clean_array
(
a
,
conv
=
None
):
b
=
[]
for
el
in
a
:
if
el
!=
''
and
el
!=
"
0
"
:
if
el
!=
""
and
el
!=
"
0
"
:
if
conv
is
not
None
:
el
=
conv
(
el
)
b
.
append
(
el
)
...
...
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