Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
Official
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
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
0inraMfauri
Official
Commits
595a5df8
Verified
Commit
595a5df8
authored
2 years ago
by
Jonathan Weth
Browse files
Options
Downloads
Patches
Plain Diff
Fix reg ex for parsing Untis first level data structure
parent
c7397cb3
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CHANGELOG.rst
+5
-0
5 additions, 0 deletions
CHANGELOG.rst
aleksis/apps/untis/tests/util/test_mysql_util.py
+10
-2
10 additions, 2 deletions
aleksis/apps/untis/tests/util/test_mysql_util.py
aleksis/apps/untis/util/mysql/util.py
+1
-1
1 addition, 1 deletion
aleksis/apps/untis/util/mysql/util.py
with
16 additions
and
3 deletions
CHANGELOG.rst
+
5
−
0
View file @
595a5df8
...
@@ -9,6 +9,11 @@ and this project adheres to `Semantic Versioning`_.
...
@@ -9,6 +9,11 @@ and this project adheres to `Semantic Versioning`_.
Unreleased
Unreleased
----------
----------
Fixed
~~~~~
* Import failed sometimes if there were lessons with names.
`2.3`_ - 2022-06-25
`2.3`_ - 2022-06-25
-------------------
-------------------
...
...
This diff is collapsed.
Click to expand it.
aleksis/apps/untis/tests/util/test_mysql_util.py
+
10
−
2
View file @
595a5df8
...
@@ -9,6 +9,8 @@ test_lesson_element = """49~0~302~7r;~0;~0~0~175608~~~~~"Freiraum: Naturwissensc
...
@@ -9,6 +9,8 @@ test_lesson_element = """49~0~302~7r;~0;~0~0~175608~~~~~"Freiraum: Naturwissensc
test_lesson_element_partial
=
"""
49~0~302~7r;~0;~0~0~175608~~~~~
"
Freiraum: Naturwissenschaften, Fokus Physik
"
~
"
Nawi
"
~~n~~;11;12;13;14;15;16;17;
"""
test_lesson_element_partial
=
"""
49~0~302~7r;~0;~0~0~175608~~~~~
"
Freiraum: Naturwissenschaften, Fokus Physik
"
~
"
Nawi
"
~~n~~;11;12;13;14;15;16;17;
"""
test_lesson_element_partial_partial
=
"
;11;12;13;14;15;16;17;
"
test_lesson_element_partial_partial
=
"
;11;12;13;14;15;16;17;
"
test_lesson_element_second
=
"""
46~0~92~45;~45;~12~11~0~~B~~~~~~n~~;18;~
"
Wp_Eb
"
~~34~0~67900~0~0~~21700,45~0~92~45;~45;~0~0~19000~~~~~~~~n~~;18;~
"
Wp_Eb
"
~~34~0~67900~0~0~~0
"""
def
test_untis_split_first
():
def
test_untis_split_first
():
assert
untis_split_first
(
""
)
==
[]
assert
untis_split_first
(
""
)
==
[]
...
@@ -20,8 +22,14 @@ def test_untis_split_first():
...
@@ -20,8 +22,14 @@ def test_untis_split_first():
assert
len
(
untis_split_first
(
test_lesson_element
))
==
2
assert
len
(
untis_split_first
(
test_lesson_element
))
==
2
assert
untis_split_first
(
test_lesson_element
)
==
[
assert
untis_split_first
(
test_lesson_element
)
==
[
"
~~n~~;11;12;13;14;15;16;17;
"
,
"""
49~0~302~7r;~0;~0~0~175608~~~~~
"
Freiraum: Naturwissenschaften, Fokus Physik
"
~
"
Nawi
"
~~n~~;11;12;13;14;15;16;17;
"""
,
"
~~n~~;11;12;13;14;15;16;17;
"
,
"""
49~0~302~7r;~0;~0~0~175608~~~~~
"
Freiraum: Naturwissenschaften, Fokus Physik
"
~
"
Nawi
"
~~n~~;11;12;13;14;15;16;17;
"""
,
]
assert
len
(
untis_split_first
(
test_lesson_element_second
))
==
2
assert
untis_split_first
(
test_lesson_element_second
)
==
[
"""
46~0~92~45;~45;~12~11~0~~B~~~~~~n~~;18;~
"
Wp_Eb
"
~~34~0~67900~0~0~~21700
"""
,
"""
45~0~92~45;~45;~0~0~19000~~~~~~~~n~~;18;~
"
Wp_Eb
"
~~34~0~67900~0~0~~0
"""
,
]
]
...
...
This diff is collapsed.
Click to expand it.
aleksis/apps/untis/util/mysql/util.py
+
1
−
1
View file @
595a5df8
...
@@ -112,7 +112,7 @@ def untis_split_first(
...
@@ -112,7 +112,7 @@ def untis_split_first(
s
:
str
,
conv
:
Callable
[[
Any
],
Any
]
=
lambda
el
:
el
,
remove_empty
:
bool
=
True
s
:
str
,
conv
:
Callable
[[
Any
],
Any
]
=
lambda
el
:
el
,
remove_empty
:
bool
=
True
)
->
Sequence
:
)
->
Sequence
:
return
clean_array
(
return
clean_array
(
re
.
findall
(
r
"
(\"[^\"]+\"|[^,\"]+)*,?
"
,
s
)[:
-
1
],
conv
=
conv
,
remove_empty
=
remove_empty
re
.
findall
(
r
"
(
(?:
\"[^\"]+\"|[^,\"]+)*
)
,?
"
,
s
)[:
-
1
],
conv
=
conv
,
remove_empty
=
remove_empty
)
)
...
...
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