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
9b4b90d2
Verified
Commit
9b4b90d2
authored
4 years ago
by
Jonathan Weth
Browse files
Options
Downloads
Patches
Plain Diff
Reformat
parent
7ef59d25
No related branches found
No related tags found
1 merge request
!13
Resolve "Support import from MySQL"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
aleksis/apps/untis/util/mysql/importers/common_data.py
+23
-10
23 additions, 10 deletions
aleksis/apps/untis/util/mysql/importers/common_data.py
with
23 additions
and
10 deletions
aleksis/apps/untis/util/mysql/importers/common_data.py
+
23
−
10
View file @
9b4b90d2
...
...
@@ -122,15 +122,17 @@ def import_teachers() -> Dict[int, core_models.Person]:
changed
=
False
if
config
.
UNTIS_IMPORT_MYSQL_UPDATE_PERSONS_NAME
and
(
new_teacher
.
first_name
!=
first_name
or
new_teacher
.
last_name
!=
last_name
new_teacher
.
first_name
!=
first_name
or
new_teacher
.
last_name
!=
last_name
):
new_teacher
.
first_name
=
first_name
new_teacher
.
last_name
=
last_name
changed
=
True
logger
.
info
(
"
First and last name updated
"
)
if
config
.
UNTIS_IMPORT_MYSQL_UPDATE_PERSONS_SHORT_NAME
and
new_teacher
.
short_name
!=
short_name
:
if
(
config
.
UNTIS_IMPORT_MYSQL_UPDATE_PERSONS_SHORT_NAME
and
new_teacher
.
short_name
!=
short_name
):
new_teacher
.
short_name
=
short_name
changed
=
True
logger
.
info
(
"
Short name updated
"
)
...
...
@@ -245,7 +247,8 @@ def import_rooms() -> Dict[int, chronos_models.Room]:
logger
.
info
(
"
Import room {} …
"
.
format
(
short_name
))
new_room
,
created
=
chronos_models
.
Room
.
objects
.
get_or_create
(
short_name
=
short_name
,
defaults
=
{
"
name
"
:
name
,
"
import_ref_untis
"
:
import_ref
}
short_name
=
short_name
,
defaults
=
{
"
name
"
:
name
,
"
import_ref_untis
"
:
import_ref
},
)
if
created
:
...
...
@@ -298,7 +301,12 @@ def import_supervision_areas() -> Dict[int, chronos_models.SupervisionArea]:
new_area
,
created
=
chronos_models
.
SupervisionArea
.
objects
.
get_or_create
(
short_name
=
short_name
,
defaults
=
{
"
name
"
:
name
,
"
colour_fg
"
:
colour_fg
,
"
colour_bg
"
:
colour_bg
,
"
import_ref_untis
"
:
import_ref
},
defaults
=
{
"
name
"
:
name
,
"
colour_fg
"
:
colour_fg
,
"
colour_bg
"
:
colour_bg
,
"
import_ref_untis
"
:
import_ref
,
},
)
if
created
:
...
...
@@ -307,9 +315,9 @@ def import_supervision_areas() -> Dict[int, chronos_models.SupervisionArea]:
changed
=
False
if
config
.
UNTIS_IMPORT_MYSQL_UPDATE_SUPERVISION_AREAS
and
(
new_area
.
name
!=
new_area
.
name
or
new_area
.
colour_fg
!=
colour_fg
or
new_area
.
colour_bg
!=
colour_bg
new_area
.
name
!=
new_area
.
name
or
new_area
.
colour_fg
!=
colour_fg
or
new_area
.
colour_bg
!=
colour_bg
):
new_area
.
name
=
name
new_area
.
colour_fg
=
colour_fg
...
...
@@ -349,7 +357,9 @@ def import_time_periods_and_breaks() -> List[List[chronos_models.TimePeriod]]:
start_time
=
time
(
time_period
.
fieldbyte1
,
time_period
.
fieldbyte2
)
end_time
=
time
(
time_period
.
fieldbyte3
,
time_period
.
fieldbyte4
)
logger
.
info
(
"
Import time period on weekday {} in the {}. period
"
.
format
(
weekday
,
period
))
logger
.
info
(
"
Import time period on weekday {} in the {}. period
"
.
format
(
weekday
,
period
)
)
new_time_period
,
created
=
chronos_models
.
TimePeriod
.
objects
.
get_or_create
(
weekday
=
weekday
,
...
...
@@ -360,7 +370,10 @@ def import_time_periods_and_breaks() -> List[List[chronos_models.TimePeriod]]:
if
created
:
logger
.
info
(
"
New time period created
"
)
if
new_time_period
.
time_start
!=
start_time
or
new_time_period
.
time_end
!=
end_time
:
if
(
new_time_period
.
time_start
!=
start_time
or
new_time_period
.
time_end
!=
end_time
):
new_time_period
.
time_start
=
start_time
new_time_period
.
time_end
=
end_time
new_time_period
.
save
()
...
...
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