Skip to content
Snippets Groups Projects
Verified Commit 7d427289 authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Fix MySQL importer

parent f6e871d8
No related branches found
No related tags found
1 merge request!13Resolve "Support import from MySQL"
...@@ -416,7 +416,7 @@ def import_time_periods() -> Dict[int, Dict[int, chronos_models.TimePeriod]]: ...@@ -416,7 +416,7 @@ def import_time_periods() -> Dict[int, Dict[int, chronos_models.TimePeriod]]:
periods = ( periods = (
run_default_filter(mysql_models.Commondata.objects, filter_term=False) run_default_filter(mysql_models.Commondata.objects, filter_term=False)
.filter(id=CommonDataId.PERIOD) .filter(id=CommonDataId.PERIOD.value)
.order_by("number", "number1") .order_by("number", "number1")
) )
......
...@@ -65,9 +65,9 @@ def import_substitutions(teachers_ref, subjects_ref, rooms_ref, classes_ref, sup ...@@ -65,9 +65,9 @@ def import_substitutions(teachers_ref, subjects_ref, rooms_ref, classes_ref, sup
# Cancellation? # Cancellation?
cancelled, cancelled_for_teachers = False, False cancelled, cancelled_for_teachers = False, False
if SubstitutionFlag.CANCELLED in sub.flags: if SubstitutionFlag.CANCELLED.value in sub.flags:
cancelled = True cancelled = True
elif SubstitutionFlag.CANCELLED_FOR_TEACHERS in sub.flags: elif SubstitutionFlag.CANCELLED_FOR_TEACHERS.value in sub.flags:
cancelled_for_teachers = True cancelled_for_teachers = True
# Comment # Comment
......
import logging import logging
from datetime import date from datetime import date, datetime
from typing import Any, Callable, Optional, Sequence, Union from typing import Any, Callable, Optional, Sequence, Union
from django.db.models import Model, QuerySet from django.db.models import Model, QuerySet
...@@ -78,7 +78,7 @@ def clean_array(seq: Sequence, conv: Callable[[Any], Any] = lambda el: el) -> Se ...@@ -78,7 +78,7 @@ def clean_array(seq: Sequence, conv: Callable[[Any], Any] = lambda el: el) -> Se
""" """
filtered = filter(lambda el: bool(el), map(lambda el: conv(el) if el else None, seq)) filtered = filter(lambda el: bool(el), map(lambda el: conv(el) if el else None, seq))
return type(a)(filtered) return type(seq)(filtered)
def untis_split_first(s: str, conv: Callable[[Any], Any] = lambda el: el) -> Sequence: def untis_split_first(s: str, conv: Callable[[Any], Any] = lambda el: el) -> Sequence:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment