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
Merge requests
!13
Resolve "Support import from MySQL"
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Resolve "Support import from MySQL"
4-support-import-from-mysql
into
master
Overview
3
Commits
62
Pipelines
0
Changes
1
Merged
Tom Teichler
requested to merge
4-support-import-from-mysql
into
master
5 years ago
Overview
3
Commits
62
Pipelines
0
Changes
1
Expand
Closes
#4 (closed)
Edited
4 years ago
by
Jonathan Weth
0
0
Merge request reports
Viewing commit
443d9bc0
Prev
Next
Show latest version
1 file
+
8
−
6
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Verified
443d9bc0
Add typing to helper functions for UNTIS dates
· 443d9bc0
Jonathan Weth
authored
5 years ago
aleksis/apps/untis/util/mysql/api_helper.py
+
8
−
6
Options
from
d
jango.utils
import
timezon
e
from
d
atetime
import
date
,
datetim
e
def
clean_array
(
a
,
conv
=
None
):
@@ -23,15 +23,17 @@ def untis_split_third(s, conv=None):
return
clean_array
(
s
.
split
(
"
;
"
),
conv
=
conv
)
DATE_FORMAT
=
"
%Y%m%d
"
UNTIS_
DATE_FORMAT
=
"
%Y%m%d
"
def
untis_date_to_date
(
untis
):
return
timezone
.
datetime
.
strptime
(
str
(
untis
),
DATE_FORMAT
)
def
untis_date_to_date
(
untis
:
int
)
->
date
:
"""
Converts a UNTIS date to a python date
"""
return
datetime
.
strptime
(
str
(
untis
),
UNTIS_DATE_FORMAT
).
date
()
def
date_to_untis_date
(
date
):
return
date
.
strftime
(
DATE_FORMAT
)
def
date_to_untis_date
(
date
:
date
)
->
int
:
"""
Converts a python date to a UNTIS date
"""
return
int
(
date
.
strftime
(
UNTIS_DATE_FORMAT
))
def
untis_colour_to_hex
(
colour
:
int
)
->
str
:
Loading