Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • AlekSIS/official/AlekSIS-App-Untis
  • sunweaver/AlekSIS-App-Untis
  • cocguPpenda/AlekSIS-App-Untis
  • 0inraMfauri/AlekSIS-App-Untis
4 results
Show changes
Commits on Source (71)
Showing
with 5069 additions and 3447 deletions
from django.conf import settings
from untisconnect.api_helper import get_term_by_ids, run_using, untis_date_to_date, date_to_untis_date, \
untis_split_first
from . import models
from timetable.settings import untis_settings
TYPE_TEACHER = 0
TYPE_ROOM = 1
TYPE_CLASS = 2
def run_all(obj, filter_term=True):
return run_default_filter(run_using(obj).all(), filter_term=filter_term)
def run_one(obj, filter_term=True):
return run_default_filter(run_using(obj), filter_term=filter_term)
def run_default_filter(obj, filter_term=True):
# Get term by settings in db
TERM_ID = untis_settings.term
SCHOOLYEAR_ID = untis_settings.school_year # 20172018
TERM = get_term_by_ids(TERM_ID, SCHOOLYEAR_ID)
SCHOOL_ID = TERM.school_id # 705103
VERSION_ID = TERM.version_id # 1
if filter_term:
return obj.filter(school_id=SCHOOL_ID, schoolyear_id=SCHOOLYEAR_ID, version_id=VERSION_ID, term_id=TERM_ID)
else:
return obj.filter(school_id=SCHOOL_ID, schoolyear_id=SCHOOLYEAR_ID, version_id=VERSION_ID)
def row_by_row_helper(db_rows, obj):
out_rows = []
for db_row in db_rows:
o = obj()
o.create(db_row)
out_rows.append(o)
return out_rows
def row_by_row(db_ref, obj, filter_term=True):
db_rows = run_all(db_ref.objects, filter_term=filter_term)
return row_by_row_helper(db_rows, obj)
def one_by_id(db_ref, obj):
# print(db_ref)
if db_ref is not None:
o = obj()
o.create(db_ref)
return o
else:
return None
###########
# TEACHER #
###########
class Teacher(object):
def __init__(self):
self.filled = False
self.id = None
self.shortcode = None
self.first_name = None
self.name = None
self.full_name = None
def __str__(self):
if self.filled:
return (self.first_name or "") + " " + (self.name or "")
else:
return "Unbekannt"
def __eq__(self, other):
if not isinstance(other, Teacher):
# don't attempt to compare against unrelated types
return NotImplemented
return self.id == other.id
def create(self, db_obj):
self.filled = True
self.id = db_obj.teacher_id
self.shortcode = db_obj.name
self.name = db_obj.longname
self.first_name = db_obj.firstname
def get_all_teachers():
teachers = row_by_row(models.Teacher, Teacher)
teachers.sort(key=lambda a: a.shortcode)
return teachers
def get_teacher_by_id(id):
teacher = run_one(models.Teacher.objects).get(teacher_id=id)
return one_by_id(teacher, Teacher)
def get_teacher_by_shortcode(shortcode):
shortcode = shortcode.upper()
teacher = run_one(models.Teacher.objects).get(name__icontains=shortcode)
return one_by_id(teacher, Teacher)
#########
# CLASS #
#########
class Class(object):
def __init__(self):
self.filled = False
self.id = None
self.name = None
self.text1 = None
self.text2 = None
self.room = None
self.teachers = []
def __str__(self):
if self.filled:
return self.name or "Unbekannt"
else:
return "Unbekannt"
def __eq__(self, other):
if not isinstance(other, Class):
# don't attempt to compare against unrelated types
return NotImplemented
return self.id == other.id
def create(self, db_obj):
self.filled = True
self.id = db_obj.class_id
self.name = db_obj.name
self.text1 = db_obj.longname
self.text2 = db_obj.text
teacher_ids = untis_split_first(db_obj.teacherids, int)
self.teachers = [get_teacher_by_id(t_id) for t_id in teacher_ids]
print(self.teachers)
# print(db_obj.room_id)
if db_obj.room_id != 0:
# print("RAUM")
self.room = get_room_by_id(db_obj.room_id)
def get_all_classes():
classes = row_by_row(models.Class, Class)
classes.sort(key=lambda a: a.name)
return classes
def get_class_by_id(id):
_class = run_one(models.Class.objects).get(class_id=id)
return one_by_id(_class, Class)
def get_class_by_name(name):
name = name[0].upper() + name[1:]
_class = run_one(models.Class.objects).filter(name__icontains=name).all()[0]
return one_by_id(_class, Class)
def format_classes(classes):
"""
Formats a list of Class objects to a combined string
example return: "9abcd" for classes 9a, 9b, 9c and 9d
:param classes: Class list
:return: combined string
"""
classes_as_dict = {}
classes = sorted(classes, key=lambda class_: class_.name)
for _class in classes:
step = _class.name[:-1]
part = _class.name[-1:]
if step not in classes_as_dict.keys():
classes_as_dict[step] = [part]
else:
classes_as_dict[step].append(part)
out = []
for key, value in classes_as_dict.items():
out.append(key + "".join(value))
return ", ".join(out)
########
# ROOM #
########
class Room(object):
def __init__(self):
self.filled = False
self.id = None
self.shortcode = None
self.name = None
def __str__(self):
if self.filled:
return self.name or "Unbekannt"
else:
return "Unbekannt"
def __eq__(self, other):
if not isinstance(other, Room):
# don't attempt to compare against unrelated types
return NotImplemented
return self.id == other.id
def create(self, db_obj):
self.filled = True
self.id = db_obj.room_id
self.shortcode = db_obj.name
self.name = db_obj.longname
def get_all_rooms():
rooms = row_by_row(models.Room, Room)
rooms.sort(key=lambda a: a.shortcode)
return rooms
def get_room_by_id(id):
room = run_one(models.Room.objects).get(room_id=id)
return one_by_id(room, Room)
########
# CORRIDOR #
########
class Corridor(object):
def __init__(self):
self.filled = False
self.id = None
self.name = None
def __str__(self):
if self.filled:
return self.name or "Unbekannt"
else:
return "Unbekannt"
def __eq__(self, other):
if not isinstance(other, Corridor):
# don't attempt to compare against unrelated types
return NotImplemented
return self.id == other.id
def create(self, db_obj):
self.filled = True
self.id = db_obj.corridor_id
self.name = db_obj.name
def get_all_corridors():
corridors = row_by_row(models.Corridor, Corridor, filter_term=False)
corridors.sort(key=lambda a: a.name)
return corridors
def get_corridor_by_id(id):
# print(id)
corridor = run_one(models.Corridor.objects, filter_term=False).get(corridor_id=id)
return one_by_id(corridor, Corridor)
###########
# SUBJECT #
###########
class Subject(object):
def __init__(self):
self.filled = False
self.id = None
self.shortcode = None
self.name = None
self.color = None
self.hex_color = None
def __str__(self):
if self.filled:
return self.shortcode or "Unbekannt"
else:
return "Unbekannt"
def __eq__(self, other):
if not isinstance(other, Teacher):
# don't attempt to compare against unrelated types
return NotImplemented
return self.id == other.id
def create(self, db_obj):
self.filled = True
self.id = db_obj.subject_id
self.shortcode = db_obj.name
self.name = db_obj.longname
self.color = db_obj.backcolor
# Convert UNTIS number to HEX
hex_bgr = str(hex(db_obj.backcolor)).replace("0x", "")
# Add beginning zeros if len < 6
if len(hex_bgr) < 6:
hex_bgr = "0" * (6 - len(hex_bgr)) + hex_bgr
# Change BGR to RGB
hex_rgb = hex_bgr[4:6] + hex_bgr[2:4] + hex_bgr[0:2]
# Add html #
self.hex_color = "#" + hex_rgb
def get_all_subjects():
subjects = row_by_row(models.Subjects, Subject, filter_term=False)
subjects.sort(key=lambda a: a.shortcode)
return subjects
def get_subject_by_id(id):
subject = run_one(models.Subjects.objects, filter_term=False).get(subject_id=id)
return one_by_id(subject, Subject)
class Absence(object):
def __init__(self):
self.filled = None
self.teacher = None
self.room = None
self.type = TYPE_TEACHER
self.from_date = None
self.to_date = None
self.from_lesson = None
self.to_lesson = None
self.is_whole_day = None
def create(self, db_obj):
self.filled = True
# print(db_obj.ida)
# print(db_obj.typea)
if db_obj.typea == 101:
self.type = TYPE_TEACHER
elif db_obj.typea == 100:
self.type = TYPE_CLASS
elif db_obj.typea == 102:
self.type = TYPE_ROOM
if self.type == TYPE_TEACHER:
# print("IDA", db_obj.ida)
self.teacher = get_teacher_by_id(db_obj.ida)
else:
self.room = get_room_by_id(db_obj.ida)
self.from_date = untis_date_to_date(db_obj.datefrom)
self.to_date = untis_date_to_date(db_obj.dateto)
self.from_lesson = db_obj.lessonfrom
self.to_lesson = db_obj.lessonto
self.is_whole_day = self.from_lesson == 1 and self.to_lesson >= settings.TIMETABLE_HEIGHT
def get_all_absences_by_date(date):
d_i = int(date_to_untis_date(date))
db_rows = run_all(models.Absence.objects.filter(dateto__gte=d_i, datefrom__lte=d_i, deleted=0), filter_term=False)
return row_by_row_helper(db_rows, Absence)
def get_absence_by_id(id):
absence = run_one(models.Absence.objects, filter_term=False).get(absence_id=id)
return one_by_id(absence, Absence)
#########
# EVENT #
#########
class Event(object):
def __init__(self):
self.filled = None
self.text = None
self.teachers = []
self.classes = []
self.rooms = []
self.absences = []
self.from_date = None
self.to_date = None
self.from_lesson = None
self.to_lesson = None
self.is_whole_day = None
def create(self, db_obj):
"""0~0~19~0~1859~0,0~0~65~0~1860~0,0~0~21~0~1861~0,0~0~3~0~1862~0"""
self.filled = True
event_parsed = db_obj.eventelement1.split(",")
elements = []
for element in event_parsed:
elements.append(element.split("~"))
for element in elements:
if element[0] != "0" and element[0] != "":
self.classes.append(element[0])
if element[2] != "0" and element[2] != "":
self.teachers.append(element[2])
if element[3] != "0" and element[3] != "":
self.rooms.append(element[3])
if element[4] != "0" and element[4] != "":
self.absences.append(element[4])
self.text = db_obj.text
self.from_date = untis_date_to_date(db_obj.datefrom)
self.to_date = untis_date_to_date(db_obj.dateto)
self.from_lesson = db_obj.lessonfrom
self.to_lesson = db_obj.lessonto
self.is_whole_day = self.from_lesson == 1 and self.to_lesson >= settings.TIMETABLE_HEIGHT
def get_all_events_by_date(date):
d_i = int(date_to_untis_date(date))
db_rows = run_all(models.Event.objects.filter(dateto__gte=d_i, datefrom__lte=d_i, deleted=0), filter_term=False)
return row_by_row_helper(db_rows, Event)
##########
# LESSON #
##########
def get_raw_lessons():
return run_all(models.Lesson.objects.filter(deleted=0))
###########
# HOLIDAY #
###########
class Holiday(object):
def __init__(self):
self.filled = False
self.name = None
self.datefrom = None
self.dateto = None
def __str__(self):
if self.filled:
return self.name or "Unbekannt"
else:
return "Unbekannt"
def create(self, db_obj):
self.filled = True
self.name = db_obj.name
self.datefrom = db_obj.datefrom
self.dateto = db_obj.dateto
def get_today_holidays(date):
# db_holidays = row_by_row(models.Holiday, Holiday)
d_i = int(date_to_untis_date(date))
db_rows = run_all(models.Holiday.objects.filter(dateto__gte=d_i, datefrom__lte=d_i), filter_term=False)
return row_by_row_helper(db_rows, Holiday)
from django.utils import timezone
from . import models
DB_NAME = 'untis'
#####################
# BASIC DEFINITIONS #
#####################
class Basic(object):
def __init__(self):
self.filled = False
self.id = None
def create(self, db_obj):
self.filled = True
def run_using(obj):
return obj.using(DB_NAME)
def get_term_by_ids(term_id, school_year_id):
data = run_using(models.Terms.objects).get(term_id=term_id, schoolyear_id=school_year_id)
# print(data.schoolyear_id)
return data
########
# TERM #
########
class Term(object):
def __init__(self):
self.filled = False
self.id = None
self.name = None
self.school_year_id = None
def create(self, db_obj):
self.filled = True
self.id = db_obj.term_id
self.name = db_obj.longname
self.school_year_id = db_obj.schoolyear_id
def get_terms():
data = run_using(models.Terms.objects).all()
terms = []
for item in data:
term = Term()
term.create(item)
terms.append(term)
# print(term.name)
return terms
##############
# SCHOOLYEAR #
##############
class SchoolYear(object):
def __init__(self):
self.filled = False
self.id = None
self.name = None
def create(self, db_obj):
self.filled = True
self.id = db_obj.schoolyear_id
self.name = db_obj.schoolyearzoned
def get_school_years():
data = run_using(models.Schoolyear.objects).all()
years = []
for item in data:
year = SchoolYear()
year.create(item)
years.append(year)
# print(term.name)
return years
################
# HELP METHODS #
################
def clean_array(a, conv=None):
b = []
for el in a:
if el != '' and el != "0":
if conv is not None:
el = conv(el)
b.append(el)
return b
def untis_split_first(s, conv=None):
return clean_array(s.split(","), conv=conv)
def untis_split_second(s, conv=None):
return clean_array(s.split("~"), conv=conv)
def untis_split_third(s, conv=None):
return clean_array(s.split(";"), conv=conv)
DATE_FORMAT = "%Y%m%d"
def untis_date_to_date(untis):
return timezone.datetime.strptime(str(untis), DATE_FORMAT)
def date_to_untis_date(date):
return date.strftime(DATE_FORMAT)
import datetime
from django.utils import timezone, formats
from schoolapps.settings import LONG_WEEK_DAYS
from untisconnect.api import TYPE_TEACHER, get_teacher_by_shortcode, TYPE_CLASS, get_class_by_name, get_all_teachers, \
get_all_classes, get_all_rooms, get_all_subjects
from userinformation import UserInformation
def get_name_for_next_week_day_from_today() -> str:
"""
Return the next week day as you would say it from today: "today", "tomorrow" or "<weekday>"
:return: Formatted date
"""
# Next weekday
next_weekday: timezone.datetime = get_next_weekday_with_time(timezone.now(), timezone.now().time())
if next_weekday.date() == timezone.now().date():
# Today
date_formatted = "heute"
elif next_weekday.date() == timezone.now().date() + timezone.timedelta(days=1):
# Tomorrow
date_formatted = "morgen"
else:
# Other weekday
date_formatted = LONG_WEEK_DAYS[next_weekday.isoweekday() - 1][0]
return date_formatted
def get_calendar_weeks(year=timezone.datetime.now().year):
weeks = []
# Get first day of year > first calendar week
first_day_of_year = timezone.datetime(year=year, month=1, day=1)
if first_day_of_year.isoweekday() != 1:
days_to_next_monday = 1 - first_day_of_year.isoweekday()
first_day_of_year += datetime.timedelta(days=days_to_next_monday)
# Go for all weeks in year and create week dict
first_day_of_week = first_day_of_year
for i in range(52):
calendar_week = i + 1
last_day_of_week = first_day_of_week + datetime.timedelta(days=4)
weeks.append({
"calendar_week": calendar_week,
"first_day": first_day_of_week,
"last_day": last_day_of_week
})
first_day_of_week += datetime.timedelta(weeks=1)
return weeks
def find_out_what_is_today(year=None, month=None, day=None):
date = timezone.datetime.now()
time = datetime.datetime.now().time()
if year is not None and day is not None and month is not None:
date = timezone.datetime(year=year, month=month, day=day)
if date != timezone.datetime.now():
time = datetime.time(0)
return date, time
def get_calendar_week(calendar_week, year=timezone.datetime.now().year):
weeks = get_calendar_weeks(year=year)
for week in weeks:
if week["calendar_week"] == calendar_week:
return week
return None
def get_next_weekday(date=None):
"""Get the next weekday by a datetime object"""
if date is None:
date = timezone.now().date()
if date.isoweekday() in {6, 7}:
if date.isoweekday() == 6:
plus = 2
else:
plus = 1
date += datetime.timedelta(days=plus)
return date
def get_next_weekday_with_time(date=None, time=None) -> datetime.datetime:
"""Get the next weekday by a datetime object"""
if date is None:
date = timezone.now().date()
if time is None:
time = timezone.now().time()
if time > datetime.time(15, 35):
date += datetime.timedelta(days=1)
if date.isoweekday() in {6, 7}:
if date.isoweekday() == 6:
plus = 2
else:
plus = 1
date += datetime.timedelta(days=plus)
return date
def calendar_week(date: datetime) -> int:
return date.isocalendar()[1]
def weekday(date: datetime) -> int:
return date.isoweekday() - 1
def format_lesson_time(time: datetime) -> str:
return formats.date_format(time, "H:i")
from dashboard.caches import DRIVE_CACHE, Cache
from .api import *
def build_drive(force_update=False):
cached = DRIVE_CACHE.get()
if cached is not False and not force_update:
print("Drive come from cache")
return cached
odrive = {
"teachers": get_all_teachers(),
"rooms": get_all_rooms(),
"classes": get_all_classes(),
"subjects": get_all_subjects(),
"corridors": get_all_corridors(),
}
drive = {}
for key, value in odrive.items():
drive[key] = {}
for el in value:
id = el.id
drive[key][id] = el
DRIVE_CACHE.update(drive)
return drive
drive = build_drive()
from django.conf import settings
from schoolapps.settings import TIMETABLE_HEIGHT
from .drive import drive
from .api_helper import untis_date_to_date, date_to_untis_date
from .api import row_by_row_helper, run_all, get_absence_by_id
from . import models
#########
# EVENT #
#########
class Event(object):
def __init__(self):
self.filled = None
self.id = None
self.text = None
self.teachers = []
self.classes = []
self.rooms = []
self.absences = []
self.from_date = None
self.to_date = None
self.from_lesson = None
self.to_lesson = None
self.is_whole_day = None
def create(self, db_obj):
"""0~0~19~0~1859~0,0~0~65~0~1860~0,0~0~21~0~1861~0,0~0~3~0~1862~0"""
self.filled = True
self.id = db_obj.event_id
event_parsed = db_obj.eventelement1.split(",")
elements = []
for element in event_parsed:
elements.append(element.split("~"))
for element in elements:
if element[0] != "0" and element[0] != "":
class_id = int(element[0])
obj = drive["classes"][class_id]
self.classes.append(obj)
if element[2] != "0" and element[2] != "":
teacher_id = int(element[2])
obj = drive["teachers"][teacher_id]
self.teachers.append(obj)
if element[3] != "0" and element[3] != "":
room_id = int(element[3])
obj = drive["rooms"][room_id]
self.rooms.append(obj)
if element[4] != "0" and element[4] != "":
# print(element[4])
try:
absence_id = int(element[4])
absence = get_absence_by_id(absence_id)
self.absences.append(absence)
except models.Absence.DoesNotExist:
pass
self.text = db_obj.text
self.from_date = untis_date_to_date(db_obj.datefrom)
self.to_date = untis_date_to_date(db_obj.dateto)
self.from_lesson = db_obj.lessonfrom
self.to_lesson = db_obj.lessonto
self.is_whole_day = self.from_lesson == 1 and self.to_lesson >= settings.TIMETABLE_HEIGHT
def get_all_events_by_date(date):
d_i = int(date_to_untis_date(date))
db_rows = run_all(models.Event.objects.filter(dateto__gte=d_i, datefrom__lte=d_i, deleted=0), filter_term=False)
rows = row_by_row_helper(db_rows, Event)
# Remap the lesson numbers matching for the given date
for i, event in enumerate(rows):
if event.from_date != event.to_date:
if event.from_date == date:
event.to_lesson = TIMETABLE_HEIGHT
elif event.to_date == date:
event.from_lesson = 1
else:
event.from_lesson = 1
event.to_lesson = TIMETABLE_HEIGHT
return rows
from django import forms
from django.utils.translation import ugettext_lazy as _
from constance import config
from material import Fieldset
from aleksis.core.forms import EditGroupForm
from aleksis.core.models import Group
class UntisUploadForm(forms.Form):
untis_xml = forms.FileField(label=_("Untis XML export"))
class GroupSubjectForm(forms.ModelForm):
child_groups = forms.ModelMultipleChoiceField(queryset=Group.objects.all())
class Meta:
model = Group
fields = [
"name",
"short_name",
"untis_subject",
]
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.fields["name"].widget = forms.HiddenInput()
self.fields["short_name"].widget = forms.HiddenInput()
GroupSubjectFormset = forms.modelformset_factory(
Group, form=GroupSubjectForm, max_num=0, extra=0
)
if config.UNTIS_IMPORT_MYSQL_USE_COURSE_GROUPS:
EditGroupForm.add_node_to_layout(Fieldset(_("UNTIS import"), "untis_subject"))
......@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-04-01 13:25+0200\n"
"POT-Creation-Date: 2020-04-28 13:31+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
......@@ -16,40 +16,147 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 "
"&& n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n"
"Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 && n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n"
#: forms.py:6
#: forms.py:12
msgid "Untis XML export"
msgstr ""
#: management/commands/untis_import.py:9
#: forms.py:40
msgid "UNTIS import"
msgstr ""
#: management/commands/untis_import_xml.py:9
msgid "Path to Untis XML export file"
msgstr ""
#: menus.py:6
msgid "Units import"
msgid "Untis XML import"
msgstr ""
#: menus.py:13
msgid "Link subjects to groups (for UNTIS MySQL import)"
msgstr ""
#: model_extensions.py:11 model_extensions.py:14 model_extensions.py:31
#: model_extensions.py:34 model_extensions.py:37 model_extensions.py:56
#: model_extensions.py:59 model_extensions.py:62 model_extensions.py:65
#: model_extensions.py:68 model_extensions.py:71 model_extensions.py:74
msgid "UNTIS import reference"
msgstr ""
#: model_extensions.py:19
msgid "UNTIS subject"
msgstr ""
#: model_extensions.py:21
msgid "The UNTIS import will use this for matching course groups (along with parent groups)."
msgstr ""
#: model_extensions.py:40
msgid "Lesson id in UNTIS"
msgstr ""
#: model_extensions.py:44 model_extensions.py:52
msgid "Number of lesson element in UNTIS"
msgstr ""
#: model_extensions.py:48
msgid "Term id in UNTIS"
msgstr ""
#: models.py:4205
msgid "Can do XML import"
msgstr ""
#: models.py:4206
msgid "Can assign subjects to groups"
msgstr ""
#: settings.py:17
msgid "Update values of existing subjects?"
msgstr ""
#: settings.py:20
msgid "Update short name of existing persons?"
msgstr ""
#: settings.py:25
msgid "Update first and last name of existing persons?"
msgstr ""
#: settings.py:30
msgid "Update short name of existing groups?"
msgstr ""
#: settings.py:33
msgid "Update name of existing groups?"
msgstr ""
#: settings.py:36
msgid "Overwrite existing owners?"
msgstr ""
#: templates/untis/untis_import.html:8 templates/untis/untis_import.html:9
msgid "Import Untis data"
#: settings.py:39
msgid "Update name of existing rooms?"
msgstr ""
#: templates/untis/untis_import.html:14
#: settings.py:42
msgid "Update values of existing supervision areas?"
msgstr ""
#: settings.py:46
msgid "Build or search course groups for every course instead of setting classes as groups."
msgstr ""
#: templates/untis/groups_subjects.html:7
#: templates/untis/groups_subjects.html:9
msgid "Assign subjects to groups"
msgstr ""
#: templates/untis/groups_subjects.html:17
msgid ""
"\n"
" You can use this form to assign subjects to groups. Please enter the exact names of the subjects as they are\n"
" saved in UNTIS (case-insensitive). These values are only used to match course groups while importing from MySQL.\n"
" "
msgstr ""
#: templates/untis/groups_subjects.html:27
msgid ""
"\n"
" If there are more than 100 groups, this table will have multiple pages. That means that you must save your\n"
" changes on every page. <strong>Please don't change the page before you saved your changes!</strong>\n"
" "
msgstr ""
#: templates/untis/groups_subjects.html:44
msgid "Group"
msgstr ""
#: templates/untis/groups_subjects.html:45
msgid "Subject"
msgstr ""
#: templates/untis/xml_import.html:7 templates/untis/xml_import.html:8
msgid "Import Untis data via XML"
msgstr ""
#: templates/untis/xml_import.html:13
msgid ""
"\n"
" Untis provides a function for exporting all data as an XML file.\n"
" "
msgstr ""
#: templates/untis/untis_import.html:21
#: templates/untis/xml_import.html:20
msgid ""
"\n"
" Newly imported data will be valid as of tomorrow.\n"
" "
msgstr ""
#: templates/untis/untis_import.html:24
#: templates/untis/xml_import.html:23
msgid ""
"\n"
" The effective dates of all existing lessons will be set to end\n"
......@@ -57,7 +164,7 @@ msgid ""
" "
msgstr ""
#: templates/untis/untis_import.html:28
#: templates/untis/xml_import.html:27
msgid ""
"\n"
" The effective dates of all newly imported lessons will be set to\n"
......@@ -65,30 +172,49 @@ msgid ""
" "
msgstr ""
#: templates/untis/untis_import.html:32
#: templates/untis/xml_import.html:31
msgid ""
"\n"
" Teachers, rooms, subjects and classes and periods will be updated in "
"place.\n"
" Teachers, rooms, subjects and classes and periods will be updated in place.\n"
" "
msgstr ""
#: util.py:78
#: templates/untis/xml_import.html:40
msgid "Import data"
msgstr ""
#: util/mysql/importers/lessons.py:49
msgid "Import lesson {}"
msgstr ""
#: util/mysql/importers/lessons.py:52
msgid " Skip because missing times"
msgstr ""
#: util/mysql/importers/lessons.py:109
msgid " Skip because missing subject"
msgstr ""
#: util/xml/xml.py:71
#, python-format
msgid "Class %s"
msgstr ""
#: util.py:92
#: util/xml/xml.py:85
#, python-format
msgid "Could not set class teacher of %(class)s to %(teacher)s."
msgstr ""
#: util.py:153
#: util/xml/xml.py:146
#, python-format
msgid "Invalid list of classes: %s"
msgstr ""
#: util.py:161
#: util/xml/xml.py:154
#, python-format
msgid "Failed to import lesson: Teacher %s does not exist."
msgstr ""
#: views.py:54
msgid "Your changes were successfully saved."
msgstr ""
......@@ -7,11 +7,10 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-04-01 13:25+0200\n"
"POT-Creation-Date: 2020-04-28 13:31+0000\n"
"PO-Revision-Date: 2019-09-15 13:40+0000\n"
"Last-Translator: Tom Teichler <tom.teichler@teckids.org>\n"
"Language-Team: German <https://translate.edugit.org/projects/aleksis-sis/"
"aleksis-app-untis/de/>\n"
"Language-Team: German <https://translate.edugit.org/projects/aleksis-sis/aleksis-app-untis/de/>\n"
"Language: de_DE\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
......@@ -19,23 +18,139 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=n != 1;\n"
"X-Generator: Weblate 3.8\n"
#: forms.py:6
#: forms.py:12
msgid "Untis XML export"
msgstr "Untis-XML-Export"
#: management/commands/untis_import.py:9
#: forms.py:40
#, fuzzy
#| msgid "Units import"
msgid "UNTIS import"
msgstr "Untis-Import"
#: management/commands/untis_import_xml.py:9
msgid "Path to Untis XML export file"
msgstr "Pfad zur Untis-XML-Exportdatei"
#: menus.py:6
msgid "Units import"
msgstr "Untis-Import"
#, fuzzy
#| msgid "Untis XML export"
msgid "Untis XML import"
msgstr "Untis-XML-Export"
#: menus.py:13
msgid "Link subjects to groups (for UNTIS MySQL import)"
msgstr ""
#: model_extensions.py:11 model_extensions.py:14 model_extensions.py:31
#: model_extensions.py:34 model_extensions.py:37 model_extensions.py:56
#: model_extensions.py:59 model_extensions.py:62 model_extensions.py:65
#: model_extensions.py:68 model_extensions.py:71 model_extensions.py:74
msgid "UNTIS import reference"
msgstr ""
#: model_extensions.py:19
msgid "UNTIS subject"
msgstr ""
#: model_extensions.py:21
msgid "The UNTIS import will use this for matching course groups (along with parent groups)."
msgstr ""
#: model_extensions.py:40
msgid "Lesson id in UNTIS"
msgstr ""
#: model_extensions.py:44 model_extensions.py:52
msgid "Number of lesson element in UNTIS"
msgstr ""
#: model_extensions.py:48
msgid "Term id in UNTIS"
msgstr ""
#: models.py:4205
#, fuzzy
#| msgid "Untis XML export"
msgid "Can do XML import"
msgstr "Untis-XML-Export"
#: models.py:4206
msgid "Can assign subjects to groups"
msgstr ""
#: settings.py:17
msgid "Update values of existing subjects?"
msgstr ""
#: settings.py:20
msgid "Update short name of existing persons?"
msgstr ""
#: settings.py:25
msgid "Update first and last name of existing persons?"
msgstr ""
#: settings.py:30
msgid "Update short name of existing groups?"
msgstr ""
#: settings.py:33
msgid "Update name of existing groups?"
msgstr ""
#: settings.py:36
msgid "Overwrite existing owners?"
msgstr ""
#: settings.py:39
msgid "Update name of existing rooms?"
msgstr ""
#: settings.py:42
msgid "Update values of existing supervision areas?"
msgstr ""
#: settings.py:46
msgid "Build or search course groups for every course instead of setting classes as groups."
msgstr ""
#: templates/untis/groups_subjects.html:7
#: templates/untis/groups_subjects.html:9
msgid "Assign subjects to groups"
msgstr ""
#: templates/untis/groups_subjects.html:17
msgid ""
"\n"
" You can use this form to assign subjects to groups. Please enter the exact names of the subjects as they are\n"
" saved in UNTIS (case-insensitive). These values are only used to match course groups while importing from MySQL.\n"
" "
msgstr ""
#: templates/untis/groups_subjects.html:27
msgid ""
"\n"
" If there are more than 100 groups, this table will have multiple pages. That means that you must save your\n"
" changes on every page. <strong>Please don't change the page before you saved your changes!</strong>\n"
" "
msgstr ""
#: templates/untis/groups_subjects.html:44
msgid "Group"
msgstr ""
#: templates/untis/groups_subjects.html:45
msgid "Subject"
msgstr ""
#: templates/untis/untis_import.html:8 templates/untis/untis_import.html:9
msgid "Import Untis data"
#: templates/untis/xml_import.html:7 templates/untis/xml_import.html:8
#, fuzzy
#| msgid "Import Untis data"
msgid "Import Untis data via XML"
msgstr "Untis-Daten importieren"
#: templates/untis/untis_import.html:14
#: templates/untis/xml_import.html:13
#, fuzzy
#| msgid ""
#| "\n"
......@@ -47,11 +162,10 @@ msgid ""
" "
msgstr ""
"\n"
" Untis bietet eine Funktion zum Exportieren aller Daten als XML-"
"Datei.\n"
" Untis bietet eine Funktion zum Exportieren aller Daten als XML-Datei.\n"
" "
#: templates/untis/untis_import.html:21
#: templates/untis/xml_import.html:20
msgid ""
"\n"
" Newly imported data will be valid as of tomorrow.\n"
......@@ -61,7 +175,7 @@ msgstr ""
" Neu importierte Daten sind ab morgen gültig.\n"
" "
#: templates/untis/untis_import.html:24
#: templates/untis/xml_import.html:23
msgid ""
"\n"
" The effective dates of all existing lessons will be set to end\n"
......@@ -73,7 +187,7 @@ msgstr ""
" heute.\n"
" "
#: templates/untis/untis_import.html:28
#: templates/untis/xml_import.html:27
msgid ""
"\n"
" The effective dates of all newly imported lessons will be set to\n"
......@@ -85,39 +199,58 @@ msgstr ""
" startet morgen.\n"
" "
#: templates/untis/untis_import.html:32
#: templates/untis/xml_import.html:31
msgid ""
"\n"
" Teachers, rooms, subjects and classes and periods will be updated in "
"place.\n"
" Teachers, rooms, subjects and classes and periods will be updated in place.\n"
" "
msgstr ""
"\n"
" Lehrer, Räume, Fächer und Klassen und Schulstunden werden "
"aktualisiert.\n"
" Lehrer, Räume, Fächer und Klassen und Schulstunden werden aktualisiert.\n"
" "
#: util.py:78
#: templates/untis/xml_import.html:40
#, fuzzy
#| msgid "Import Untis data"
msgid "Import data"
msgstr "Untis-Daten importieren"
#: util/mysql/importers/lessons.py:49
msgid "Import lesson {}"
msgstr ""
#: util/mysql/importers/lessons.py:52
msgid " Skip because missing times"
msgstr ""
#: util/mysql/importers/lessons.py:109
msgid " Skip because missing subject"
msgstr ""
#: util/xml/xml.py:71
#, python-format
msgid "Class %s"
msgstr "Klasse %s"
#: util.py:92
#: util/xml/xml.py:85
#, python-format
msgid "Could not set class teacher of %(class)s to %(teacher)s."
msgstr ""
"Der Klassenlehrer von %(class)s konnte nicht auf %(teacher)s gesetzt werden."
msgstr "Der Klassenlehrer von %(class)s konnte nicht auf %(teacher)s gesetzt werden."
#: util.py:153
#: util/xml/xml.py:146
#, python-format
msgid "Invalid list of classes: %s"
msgstr "Ungültige Liste von Klassen: %s"
#: util.py:161
#: util/xml/xml.py:154
#, python-format
msgid "Failed to import lesson: Teacher %s does not exist."
msgstr "Fehler beim Importieren der Stunde: Lehrer %s existiert nicht."
#: views.py:54
msgid "Your changes were successfully saved."
msgstr ""
#~ msgid "Process"
#~ msgstr "Importieren"
......
......@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-04-01 13:25+0200\n"
"POT-Creation-Date: 2020-04-28 13:31+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
......@@ -18,37 +18,145 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: forms.py:6
#: forms.py:12
msgid "Untis XML export"
msgstr ""
#: management/commands/untis_import.py:9
#: forms.py:40
msgid "UNTIS import"
msgstr ""
#: management/commands/untis_import_xml.py:9
msgid "Path to Untis XML export file"
msgstr ""
#: menus.py:6
msgid "Units import"
msgid "Untis XML import"
msgstr ""
#: menus.py:13
msgid "Link subjects to groups (for UNTIS MySQL import)"
msgstr ""
#: model_extensions.py:11 model_extensions.py:14 model_extensions.py:31
#: model_extensions.py:34 model_extensions.py:37 model_extensions.py:56
#: model_extensions.py:59 model_extensions.py:62 model_extensions.py:65
#: model_extensions.py:68 model_extensions.py:71 model_extensions.py:74
msgid "UNTIS import reference"
msgstr ""
#: model_extensions.py:19
msgid "UNTIS subject"
msgstr ""
#: model_extensions.py:21
msgid "The UNTIS import will use this for matching course groups (along with parent groups)."
msgstr ""
#: model_extensions.py:40
msgid "Lesson id in UNTIS"
msgstr ""
#: model_extensions.py:44 model_extensions.py:52
msgid "Number of lesson element in UNTIS"
msgstr ""
#: model_extensions.py:48
msgid "Term id in UNTIS"
msgstr ""
#: models.py:4205
msgid "Can do XML import"
msgstr ""
#: models.py:4206
msgid "Can assign subjects to groups"
msgstr ""
#: settings.py:17
msgid "Update values of existing subjects?"
msgstr ""
#: settings.py:20
msgid "Update short name of existing persons?"
msgstr ""
#: settings.py:25
msgid "Update first and last name of existing persons?"
msgstr ""
#: settings.py:30
msgid "Update short name of existing groups?"
msgstr ""
#: settings.py:33
msgid "Update name of existing groups?"
msgstr ""
#: settings.py:36
msgid "Overwrite existing owners?"
msgstr ""
#: templates/untis/untis_import.html:8 templates/untis/untis_import.html:9
msgid "Import Untis data"
#: settings.py:39
msgid "Update name of existing rooms?"
msgstr ""
#: templates/untis/untis_import.html:14
#: settings.py:42
msgid "Update values of existing supervision areas?"
msgstr ""
#: settings.py:46
msgid "Build or search course groups for every course instead of setting classes as groups."
msgstr ""
#: templates/untis/groups_subjects.html:7
#: templates/untis/groups_subjects.html:9
msgid "Assign subjects to groups"
msgstr ""
#: templates/untis/groups_subjects.html:17
msgid ""
"\n"
" You can use this form to assign subjects to groups. Please enter the exact names of the subjects as they are\n"
" saved in UNTIS (case-insensitive). These values are only used to match course groups while importing from MySQL.\n"
" "
msgstr ""
#: templates/untis/groups_subjects.html:27
msgid ""
"\n"
" If there are more than 100 groups, this table will have multiple pages. That means that you must save your\n"
" changes on every page. <strong>Please don't change the page before you saved your changes!</strong>\n"
" "
msgstr ""
#: templates/untis/groups_subjects.html:44
msgid "Group"
msgstr ""
#: templates/untis/groups_subjects.html:45
msgid "Subject"
msgstr ""
#: templates/untis/xml_import.html:7 templates/untis/xml_import.html:8
msgid "Import Untis data via XML"
msgstr ""
#: templates/untis/xml_import.html:13
msgid ""
"\n"
" Untis provides a function for exporting all data as an XML file.\n"
" "
msgstr ""
#: templates/untis/untis_import.html:21
#: templates/untis/xml_import.html:20
msgid ""
"\n"
" Newly imported data will be valid as of tomorrow.\n"
" "
msgstr ""
#: templates/untis/untis_import.html:24
#: templates/untis/xml_import.html:23
msgid ""
"\n"
" The effective dates of all existing lessons will be set to end\n"
......@@ -56,7 +164,7 @@ msgid ""
" "
msgstr ""
#: templates/untis/untis_import.html:28
#: templates/untis/xml_import.html:27
msgid ""
"\n"
" The effective dates of all newly imported lessons will be set to\n"
......@@ -64,30 +172,49 @@ msgid ""
" "
msgstr ""
#: templates/untis/untis_import.html:32
#: templates/untis/xml_import.html:31
msgid ""
"\n"
" Teachers, rooms, subjects and classes and periods will be updated in "
"place.\n"
" Teachers, rooms, subjects and classes and periods will be updated in place.\n"
" "
msgstr ""
#: util.py:78
#: templates/untis/xml_import.html:40
msgid "Import data"
msgstr ""
#: util/mysql/importers/lessons.py:49
msgid "Import lesson {}"
msgstr ""
#: util/mysql/importers/lessons.py:52
msgid " Skip because missing times"
msgstr ""
#: util/mysql/importers/lessons.py:109
msgid " Skip because missing subject"
msgstr ""
#: util/xml/xml.py:71
#, python-format
msgid "Class %s"
msgstr ""
#: util.py:92
#: util/xml/xml.py:85
#, python-format
msgid "Could not set class teacher of %(class)s to %(teacher)s."
msgstr ""
#: util.py:153
#: util/xml/xml.py:146
#, python-format
msgid "Invalid list of classes: %s"
msgstr ""
#: util.py:161
#: util/xml/xml.py:154
#, python-format
msgid "Failed to import lesson: Teacher %s does not exist."
msgstr ""
#: views.py:54
msgid "Your changes were successfully saved."
msgstr ""
......@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-04-01 13:25+0200\n"
"POT-Creation-Date: 2020-04-28 13:31+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
......@@ -17,37 +17,145 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: forms.py:6
#: forms.py:12
msgid "Untis XML export"
msgstr ""
#: management/commands/untis_import.py:9
#: forms.py:40
msgid "UNTIS import"
msgstr ""
#: management/commands/untis_import_xml.py:9
msgid "Path to Untis XML export file"
msgstr ""
#: menus.py:6
msgid "Units import"
msgid "Untis XML import"
msgstr ""
#: menus.py:13
msgid "Link subjects to groups (for UNTIS MySQL import)"
msgstr ""
#: model_extensions.py:11 model_extensions.py:14 model_extensions.py:31
#: model_extensions.py:34 model_extensions.py:37 model_extensions.py:56
#: model_extensions.py:59 model_extensions.py:62 model_extensions.py:65
#: model_extensions.py:68 model_extensions.py:71 model_extensions.py:74
msgid "UNTIS import reference"
msgstr ""
#: model_extensions.py:19
msgid "UNTIS subject"
msgstr ""
#: model_extensions.py:21
msgid "The UNTIS import will use this for matching course groups (along with parent groups)."
msgstr ""
#: model_extensions.py:40
msgid "Lesson id in UNTIS"
msgstr ""
#: model_extensions.py:44 model_extensions.py:52
msgid "Number of lesson element in UNTIS"
msgstr ""
#: model_extensions.py:48
msgid "Term id in UNTIS"
msgstr ""
#: models.py:4205
msgid "Can do XML import"
msgstr ""
#: models.py:4206
msgid "Can assign subjects to groups"
msgstr ""
#: settings.py:17
msgid "Update values of existing subjects?"
msgstr ""
#: settings.py:20
msgid "Update short name of existing persons?"
msgstr ""
#: settings.py:25
msgid "Update first and last name of existing persons?"
msgstr ""
#: settings.py:30
msgid "Update short name of existing groups?"
msgstr ""
#: settings.py:33
msgid "Update name of existing groups?"
msgstr ""
#: settings.py:36
msgid "Overwrite existing owners?"
msgstr ""
#: templates/untis/untis_import.html:8 templates/untis/untis_import.html:9
msgid "Import Untis data"
#: settings.py:39
msgid "Update name of existing rooms?"
msgstr ""
#: templates/untis/untis_import.html:14
#: settings.py:42
msgid "Update values of existing supervision areas?"
msgstr ""
#: settings.py:46
msgid "Build or search course groups for every course instead of setting classes as groups."
msgstr ""
#: templates/untis/groups_subjects.html:7
#: templates/untis/groups_subjects.html:9
msgid "Assign subjects to groups"
msgstr ""
#: templates/untis/groups_subjects.html:17
msgid ""
"\n"
" You can use this form to assign subjects to groups. Please enter the exact names of the subjects as they are\n"
" saved in UNTIS (case-insensitive). These values are only used to match course groups while importing from MySQL.\n"
" "
msgstr ""
#: templates/untis/groups_subjects.html:27
msgid ""
"\n"
" If there are more than 100 groups, this table will have multiple pages. That means that you must save your\n"
" changes on every page. <strong>Please don't change the page before you saved your changes!</strong>\n"
" "
msgstr ""
#: templates/untis/groups_subjects.html:44
msgid "Group"
msgstr ""
#: templates/untis/groups_subjects.html:45
msgid "Subject"
msgstr ""
#: templates/untis/xml_import.html:7 templates/untis/xml_import.html:8
msgid "Import Untis data via XML"
msgstr ""
#: templates/untis/xml_import.html:13
msgid ""
"\n"
" Untis provides a function for exporting all data as an XML file.\n"
" "
msgstr ""
#: templates/untis/untis_import.html:21
#: templates/untis/xml_import.html:20
msgid ""
"\n"
" Newly imported data will be valid as of tomorrow.\n"
" "
msgstr ""
#: templates/untis/untis_import.html:24
#: templates/untis/xml_import.html:23
msgid ""
"\n"
" The effective dates of all existing lessons will be set to end\n"
......@@ -55,7 +163,7 @@ msgid ""
" "
msgstr ""
#: templates/untis/untis_import.html:28
#: templates/untis/xml_import.html:27
msgid ""
"\n"
" The effective dates of all newly imported lessons will be set to\n"
......@@ -63,30 +171,49 @@ msgid ""
" "
msgstr ""
#: templates/untis/untis_import.html:32
#: templates/untis/xml_import.html:31
msgid ""
"\n"
" Teachers, rooms, subjects and classes and periods will be updated in "
"place.\n"
" Teachers, rooms, subjects and classes and periods will be updated in place.\n"
" "
msgstr ""
#: util.py:78
#: templates/untis/xml_import.html:40
msgid "Import data"
msgstr ""
#: util/mysql/importers/lessons.py:49
msgid "Import lesson {}"
msgstr ""
#: util/mysql/importers/lessons.py:52
msgid " Skip because missing times"
msgstr ""
#: util/mysql/importers/lessons.py:109
msgid " Skip because missing subject"
msgstr ""
#: util/xml/xml.py:71
#, python-format
msgid "Class %s"
msgstr ""
#: util.py:92
#: util/xml/xml.py:85
#, python-format
msgid "Could not set class teacher of %(class)s to %(teacher)s."
msgstr ""
#: util.py:153
#: util/xml/xml.py:146
#, python-format
msgid "Invalid list of classes: %s"
msgstr ""
#: util.py:161
#: util/xml/xml.py:154
#, python-format
msgid "Failed to import lesson: Teacher %s does not exist."
msgstr ""
#: views.py:54
msgid "Your changes were successfully saved."
msgstr ""
......@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-04-01 13:25+0200\n"
"POT-Creation-Date: 2020-04-28 13:31+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
......@@ -17,37 +17,145 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: forms.py:6
#: forms.py:12
msgid "Untis XML export"
msgstr ""
#: management/commands/untis_import.py:9
#: forms.py:40
msgid "UNTIS import"
msgstr ""
#: management/commands/untis_import_xml.py:9
msgid "Path to Untis XML export file"
msgstr ""
#: menus.py:6
msgid "Units import"
msgid "Untis XML import"
msgstr ""
#: menus.py:13
msgid "Link subjects to groups (for UNTIS MySQL import)"
msgstr ""
#: model_extensions.py:11 model_extensions.py:14 model_extensions.py:31
#: model_extensions.py:34 model_extensions.py:37 model_extensions.py:56
#: model_extensions.py:59 model_extensions.py:62 model_extensions.py:65
#: model_extensions.py:68 model_extensions.py:71 model_extensions.py:74
msgid "UNTIS import reference"
msgstr ""
#: model_extensions.py:19
msgid "UNTIS subject"
msgstr ""
#: model_extensions.py:21
msgid "The UNTIS import will use this for matching course groups (along with parent groups)."
msgstr ""
#: model_extensions.py:40
msgid "Lesson id in UNTIS"
msgstr ""
#: model_extensions.py:44 model_extensions.py:52
msgid "Number of lesson element in UNTIS"
msgstr ""
#: model_extensions.py:48
msgid "Term id in UNTIS"
msgstr ""
#: models.py:4205
msgid "Can do XML import"
msgstr ""
#: models.py:4206
msgid "Can assign subjects to groups"
msgstr ""
#: settings.py:17
msgid "Update values of existing subjects?"
msgstr ""
#: settings.py:20
msgid "Update short name of existing persons?"
msgstr ""
#: settings.py:25
msgid "Update first and last name of existing persons?"
msgstr ""
#: settings.py:30
msgid "Update short name of existing groups?"
msgstr ""
#: settings.py:33
msgid "Update name of existing groups?"
msgstr ""
#: settings.py:36
msgid "Overwrite existing owners?"
msgstr ""
#: templates/untis/untis_import.html:8 templates/untis/untis_import.html:9
msgid "Import Untis data"
#: settings.py:39
msgid "Update name of existing rooms?"
msgstr ""
#: templates/untis/untis_import.html:14
#: settings.py:42
msgid "Update values of existing supervision areas?"
msgstr ""
#: settings.py:46
msgid "Build or search course groups for every course instead of setting classes as groups."
msgstr ""
#: templates/untis/groups_subjects.html:7
#: templates/untis/groups_subjects.html:9
msgid "Assign subjects to groups"
msgstr ""
#: templates/untis/groups_subjects.html:17
msgid ""
"\n"
" You can use this form to assign subjects to groups. Please enter the exact names of the subjects as they are\n"
" saved in UNTIS (case-insensitive). These values are only used to match course groups while importing from MySQL.\n"
" "
msgstr ""
#: templates/untis/groups_subjects.html:27
msgid ""
"\n"
" If there are more than 100 groups, this table will have multiple pages. That means that you must save your\n"
" changes on every page. <strong>Please don't change the page before you saved your changes!</strong>\n"
" "
msgstr ""
#: templates/untis/groups_subjects.html:44
msgid "Group"
msgstr ""
#: templates/untis/groups_subjects.html:45
msgid "Subject"
msgstr ""
#: templates/untis/xml_import.html:7 templates/untis/xml_import.html:8
msgid "Import Untis data via XML"
msgstr ""
#: templates/untis/xml_import.html:13
msgid ""
"\n"
" Untis provides a function for exporting all data as an XML file.\n"
" "
msgstr ""
#: templates/untis/untis_import.html:21
#: templates/untis/xml_import.html:20
msgid ""
"\n"
" Newly imported data will be valid as of tomorrow.\n"
" "
msgstr ""
#: templates/untis/untis_import.html:24
#: templates/untis/xml_import.html:23
msgid ""
"\n"
" The effective dates of all existing lessons will be set to end\n"
......@@ -55,7 +163,7 @@ msgid ""
" "
msgstr ""
#: templates/untis/untis_import.html:28
#: templates/untis/xml_import.html:27
msgid ""
"\n"
" The effective dates of all newly imported lessons will be set to\n"
......@@ -63,30 +171,49 @@ msgid ""
" "
msgstr ""
#: templates/untis/untis_import.html:32
#: templates/untis/xml_import.html:31
msgid ""
"\n"
" Teachers, rooms, subjects and classes and periods will be updated in "
"place.\n"
" Teachers, rooms, subjects and classes and periods will be updated in place.\n"
" "
msgstr ""
#: util.py:78
#: templates/untis/xml_import.html:40
msgid "Import data"
msgstr ""
#: util/mysql/importers/lessons.py:49
msgid "Import lesson {}"
msgstr ""
#: util/mysql/importers/lessons.py:52
msgid " Skip because missing times"
msgstr ""
#: util/mysql/importers/lessons.py:109
msgid " Skip because missing subject"
msgstr ""
#: util/xml/xml.py:71
#, python-format
msgid "Class %s"
msgstr ""
#: util.py:92
#: util/xml/xml.py:85
#, python-format
msgid "Could not set class teacher of %(class)s to %(teacher)s."
msgstr ""
#: util.py:153
#: util/xml/xml.py:146
#, python-format
msgid "Invalid list of classes: %s"
msgstr ""
#: util.py:161
#: util/xml/xml.py:154
#, python-format
msgid "Failed to import lesson: Teacher %s does not exist."
msgstr ""
#: views.py:54
msgid "Your changes were successfully saved."
msgstr ""
......@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-04-01 13:25+0200\n"
"POT-Creation-Date: 2020-04-28 13:31+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
......@@ -17,37 +17,145 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#: forms.py:6
#: forms.py:12
msgid "Untis XML export"
msgstr ""
#: management/commands/untis_import.py:9
#: forms.py:40
msgid "UNTIS import"
msgstr ""
#: management/commands/untis_import_xml.py:9
msgid "Path to Untis XML export file"
msgstr ""
#: menus.py:6
msgid "Units import"
msgid "Untis XML import"
msgstr ""
#: menus.py:13
msgid "Link subjects to groups (for UNTIS MySQL import)"
msgstr ""
#: model_extensions.py:11 model_extensions.py:14 model_extensions.py:31
#: model_extensions.py:34 model_extensions.py:37 model_extensions.py:56
#: model_extensions.py:59 model_extensions.py:62 model_extensions.py:65
#: model_extensions.py:68 model_extensions.py:71 model_extensions.py:74
msgid "UNTIS import reference"
msgstr ""
#: model_extensions.py:19
msgid "UNTIS subject"
msgstr ""
#: model_extensions.py:21
msgid "The UNTIS import will use this for matching course groups (along with parent groups)."
msgstr ""
#: model_extensions.py:40
msgid "Lesson id in UNTIS"
msgstr ""
#: model_extensions.py:44 model_extensions.py:52
msgid "Number of lesson element in UNTIS"
msgstr ""
#: model_extensions.py:48
msgid "Term id in UNTIS"
msgstr ""
#: models.py:4205
msgid "Can do XML import"
msgstr ""
#: models.py:4206
msgid "Can assign subjects to groups"
msgstr ""
#: settings.py:17
msgid "Update values of existing subjects?"
msgstr ""
#: settings.py:20
msgid "Update short name of existing persons?"
msgstr ""
#: settings.py:25
msgid "Update first and last name of existing persons?"
msgstr ""
#: settings.py:30
msgid "Update short name of existing groups?"
msgstr ""
#: settings.py:33
msgid "Update name of existing groups?"
msgstr ""
#: settings.py:36
msgid "Overwrite existing owners?"
msgstr ""
#: templates/untis/untis_import.html:8 templates/untis/untis_import.html:9
msgid "Import Untis data"
#: settings.py:39
msgid "Update name of existing rooms?"
msgstr ""
#: templates/untis/untis_import.html:14
#: settings.py:42
msgid "Update values of existing supervision areas?"
msgstr ""
#: settings.py:46
msgid "Build or search course groups for every course instead of setting classes as groups."
msgstr ""
#: templates/untis/groups_subjects.html:7
#: templates/untis/groups_subjects.html:9
msgid "Assign subjects to groups"
msgstr ""
#: templates/untis/groups_subjects.html:17
msgid ""
"\n"
" You can use this form to assign subjects to groups. Please enter the exact names of the subjects as they are\n"
" saved in UNTIS (case-insensitive). These values are only used to match course groups while importing from MySQL.\n"
" "
msgstr ""
#: templates/untis/groups_subjects.html:27
msgid ""
"\n"
" If there are more than 100 groups, this table will have multiple pages. That means that you must save your\n"
" changes on every page. <strong>Please don't change the page before you saved your changes!</strong>\n"
" "
msgstr ""
#: templates/untis/groups_subjects.html:44
msgid "Group"
msgstr ""
#: templates/untis/groups_subjects.html:45
msgid "Subject"
msgstr ""
#: templates/untis/xml_import.html:7 templates/untis/xml_import.html:8
msgid "Import Untis data via XML"
msgstr ""
#: templates/untis/xml_import.html:13
msgid ""
"\n"
" Untis provides a function for exporting all data as an XML file.\n"
" "
msgstr ""
#: templates/untis/untis_import.html:21
#: templates/untis/xml_import.html:20
msgid ""
"\n"
" Newly imported data will be valid as of tomorrow.\n"
" "
msgstr ""
#: templates/untis/untis_import.html:24
#: templates/untis/xml_import.html:23
msgid ""
"\n"
" The effective dates of all existing lessons will be set to end\n"
......@@ -55,7 +163,7 @@ msgid ""
" "
msgstr ""
#: templates/untis/untis_import.html:28
#: templates/untis/xml_import.html:27
msgid ""
"\n"
" The effective dates of all newly imported lessons will be set to\n"
......@@ -63,30 +171,49 @@ msgid ""
" "
msgstr ""
#: templates/untis/untis_import.html:32
#: templates/untis/xml_import.html:31
msgid ""
"\n"
" Teachers, rooms, subjects and classes and periods will be updated in "
"place.\n"
" Teachers, rooms, subjects and classes and periods will be updated in place.\n"
" "
msgstr ""
#: util.py:78
#: templates/untis/xml_import.html:40
msgid "Import data"
msgstr ""
#: util/mysql/importers/lessons.py:49
msgid "Import lesson {}"
msgstr ""
#: util/mysql/importers/lessons.py:52
msgid " Skip because missing times"
msgstr ""
#: util/mysql/importers/lessons.py:109
msgid " Skip because missing subject"
msgstr ""
#: util/xml/xml.py:71
#, python-format
msgid "Class %s"
msgstr ""
#: util.py:92
#: util/xml/xml.py:85
#, python-format
msgid "Could not set class teacher of %(class)s to %(teacher)s."
msgstr ""
#: util.py:153
#: util/xml/xml.py:146
#, python-format
msgid "Invalid list of classes: %s"
msgstr ""
#: util.py:161
#: util/xml/xml.py:154
#, python-format
msgid "Failed to import lesson: Teacher %s does not exist."
msgstr ""
#: views.py:54
msgid "Your changes were successfully saved."
msgstr ""
from django.core.management.base import BaseCommand
from ...tasks import untis_import_mysql
class Command(BaseCommand):
def handle(self, *args, **options):
untis_import_mysql()
from django.core.management.base import BaseCommand
from django.utils.translation import ugettext as _
from ...util import untis_import_xml
from ...util.xml.xml import untis_import_xml
class Command(BaseCommand):
......
......@@ -3,13 +3,18 @@ from django.utils.translation import ugettext_lazy as _
MENUS = {
"DATA_MANAGEMENT_MENU": [
{
"name": _("Units import"),
"url": "untis_import",
"name": _("Untis XML import"),
"url": "untis_xml_import",
"validators": [
"menu_generator.validators.is_authenticated",
"menu_generator.validators.is_superuser",
"aleksis.core.util.core_helpers.has_person",
("aleksis.core.util.predicates.permission_validator", "untis.do_xml_import"),
],
}
},
{
"name": _("Link subjects to groups (for UNTIS MySQL import)"),
"url": "untis_groups_subjects",
"validators": [
("aleksis.core.util.predicates.permission_validator", "untis.assign_subjects_to_groups"),
],
},
]
}
from django.utils.translation import gettext as _
from constance import config
from jsonstore import CharField, IntegerField
from aleksis.apps.chronos import models as chronos_models
from aleksis.core import models as core_models
# Core models
core_models.Person.field(
import_ref_untis=IntegerField(verbose_name=_("UNTIS import reference"), null=True, blank=True)
)
core_models.Group.field(
import_ref_untis=IntegerField(verbose_name=_("UNTIS import reference"), null=True, blank=True)
)
if config.UNTIS_IMPORT_MYSQL_USE_COURSE_GROUPS:
core_models.Group.field(
untis_subject=CharField(
verbose_name=_("UNTIS subject"),
help_text=_(
"The UNTIS import will use this for matching course groups (along with parent groups)."
),
blank=True,
null=True,
max_length=255,
)
)
# Chronos models
chronos_models.Subject.field(
import_ref_untis=IntegerField(verbose_name=_("UNTIS import reference"), null=True, blank=True)
)
chronos_models.Room.field(
import_ref_untis=IntegerField(verbose_name=_("UNTIS import reference"), null=True, blank=True)
)
chronos_models.SupervisionArea.field(
import_ref_untis=IntegerField(verbose_name=_("UNTIS import reference"), null=True, blank=True)
)
chronos_models.Lesson.field(
lesson_id_untis=IntegerField(verbose_name=_("Lesson id in UNTIS"), null=True, blank=True)
)
chronos_models.Lesson.field(
element_id_untis=IntegerField(
verbose_name=_("Number of lesson element in UNTIS"), null=True, blank=True
)
)
chronos_models.Lesson.field(
term_untis=IntegerField(verbose_name=_("Term id in UNTIS"), null=True, blank=True)
)
chronos_models.LessonPeriod.field(
element_id_untis=IntegerField(
verbose_name=_("Number of lesson element in UNTIS"), null=True, blank=True
)
)
chronos_models.LessonSubstitution.field(
import_ref_untis=IntegerField(verbose_name=_("UNTIS import reference"), null=True, blank=True)
)
chronos_models.SupervisionSubstitution.field(
import_ref_untis=IntegerField(verbose_name=_("UNTIS import reference"), null=True, blank=True)
)
chronos_models.AbsenceReason.field(
import_ref_untis=IntegerField(verbose_name=_("UNTIS import reference"), null=True, blank=True)
)
chronos_models.Absence.field(
import_ref_untis=IntegerField(verbose_name=_("UNTIS import reference"), null=True, blank=True)
)
chronos_models.Event.field(
import_ref_untis=IntegerField(verbose_name=_("UNTIS import reference"), null=True, blank=True)
)
chronos_models.Holiday.field(
import_ref_untis=IntegerField(verbose_name=_("UNTIS import reference"), null=True, blank=True)
)
chronos_models.ExtraLesson.field(
import_ref_untis=IntegerField(verbose_name=_("UNTIS import reference"), null=True, blank=True)
)
This diff is collapsed.
from dashboard import caches
from .api import *
from .api_helper import untis_split_third
from .drive import drive
class Lesson(object):
def __init__(self):
self.filled = False
self.id = None
self.elements = []
self.times = []
def add_element(self, teacher, subject, rooms=[], classes=[]):
el = LessonElement()
el.create(teacher, subject, rooms, classes)
self.elements.append(el)
def add_time(self, day, hour, rooms=[]):
el = LessonTime()
el.create(day, hour, rooms)
self.times.append(el)
def create(self, raw_lesson, drive):
self.filled = True
# Split data (,)
lesson_id = raw_lesson.lesson_id
self.id = lesson_id
raw_lesson_data = raw_lesson.lessonelement1.split(",")
raw_time_data = raw_lesson.lesson_tt.split(",")
rtd2 = []
for el in raw_time_data:
rtd2.append(el.split("~"))
# print(rtd2)
for el in rtd2:
day = int(el[1])
hour = int(el[2])
room_ids = untis_split_third(el[3], conv=int)
rooms = []
for room_id in room_ids:
r = drive["rooms"][room_id]
rooms.append(r)
self.add_time(day, hour, rooms)
# print(raw_lesson_data)
# print(raw_time_data)
# Split data more (~)
rld2 = []
for el in raw_lesson_data:
rld2.append(el.split("~"))
# print(rld2)
for i, el in enumerate(rld2):
teacher_id = int(el[0])
subject_id = int(el[2])
class_ids = untis_split_third(el[17], conv=int)
# print("TEACHER – ", teacher_id, "; SUBJECT – ", subject_id, "; ROOMS – ", room_ids, "; CLASSES – ",
# class_ids)
if teacher_id != 0:
teacher = drive["teachers"][teacher_id]
else:
teacher = None
if subject_id != 0:
subject = drive["subjects"][subject_id]
else:
subject = None
rooms = []
classes = []
for class_id in class_ids:
c = drive["classes"][class_id]
classes.append(c)
# print("TEACHER – ", teacher, "; SUBJECT – ", subject, "; ROOMS – ", rooms,
# "; CLASSES – ", classes)
self.add_element(teacher, subject, rooms, classes)
class LessonElement(object):
def __init__(self):
self.teacher = None
self.subject = None
self.rooms = []
self.classes = []
def create(self, teacher, subject, rooms=[], classes=[]):
self.teacher = teacher
self.subject = subject
self.rooms = rooms
self.classes = classes
class LessonTime(object):
def __init__(self):
self.hour = None
self.day = None
self.rooms = []
def create(self, day, hour, rooms=[]):
self.day = day
self.hour = hour
self.rooms = rooms
def parse(force_update=False):
global drive
cached = caches.PARSED_LESSONS_CACHE.get()
if cached is not False and not force_update:
# print("Lessons come from cache")
return cached
lessons = []
# Load lessons from Django ORM
raw_lessons = get_raw_lessons()
for raw_lesson in raw_lessons:
if raw_lesson.lesson_tt and raw_lesson.lessonelement1:
# Create object
lesson_obj = Lesson()
lesson_obj.create(raw_lesson, drive)
lessons.append(lesson_obj)
# print("Lesson cache was refreshed")
caches.PARSED_LESSONS_CACHE.update(lessons)
return lessons
def get_lesson_by_id(id):
global drive
lesson = Lesson()
raw_lesson = run_one(models.Lesson.objects, filter_term=True).get(lesson_id=id)
lesson.create(raw_lesson, drive)
return lesson
def get_lesson_element_by_id_and_teacher(lesson_id, teacher, hour=None, weekday=None):
try:
lesson = get_lesson_by_id(lesson_id)
except Exception:
return None, None
el = None
i = 0
if teacher is not None:
for i, element in enumerate(lesson.elements):
if element.teacher is not None:
if element.teacher.id == teacher.id:
el = element
break
elif len(lesson.elements) > 0:
el = lesson.elements[0]
else:
el = None
t = None
for time in lesson.times:
if time.day == weekday and time.hour == hour:
t = time
room = None
if t is not None and len(t.rooms) > i:
room = t.rooms[i]
if el is not None:
return el, room
return None, None
import datetime
from django.utils import timezone
from dashboard import plan_caches
from schoolapps import settings
from schoolapps.settings import LESSONS
from untisconnect.api import TYPE_CLASS, TYPE_TEACHER, TYPE_ROOM
from untisconnect.api import format_classes, get_today_holidays
from untisconnect.datetimeutils import format_lesson_time
from untisconnect.events import get_all_events_by_date
from untisconnect.parse import parse
from untisconnect.sub import get_substitutions_by_date_as_dict, TYPE_CANCELLATION, generate_event_table
class LessonContainer(object):
"""
Needed for Django template because template language does not support dictionaries
Saves the time object and the lesson elements
"""
def __init__(self, ):
self.time = None
self.elements = []
def set_time(self, time):
self.time = time
def append(self, element):
self.elements.append(element)
class LessonElementContainer(object):
"""
Needed for Django template because template language does not support dictionaries
Saves the lesson element object and the room (from time object)
"""
def __init__(self, element, room, substitution=None):
self.element = element
self.room = room
self.substitution = substitution
self.is_old = False #
self.is_event = substitution["table"].is_event if substitution is not None else False
if self.element is not None:
self.classes_formatted = format_classes(self.element.classes)
def parse_lesson_times():
times = []
for i, t in enumerate(LESSONS):
start_split = t[0].split(":")
start_time = timezone.datetime(year=2000, day=1, month=1, hour=int(start_split[0]), minute=int(start_split[1]))
end_time = start_time + timezone.timedelta(minutes=45)
times.append({
"number": i + 1,
"number_format": t[1],
"start": start_time,
"start_format": format_lesson_time(start_time),
"end": end_time,
"end_format": format_lesson_time(end_time)
})
return times
def get_plan(type, id, smart=False, monday_of_week=None, force_update=False):
""" Generates a plan for type (TYPE_TEACHER, TYPE_CLASS, TYPE_ROOM) and a id of the teacher (class, room)"""
# Check cache
cache = plan_caches.get_cache_for_plan(type, id, smart, monday_of_week)
cached = cache.get()
# print(cached)
if cached is not False and not force_update:
# print("Plan come from cache", cache.id)
return cached
# Get parsed lessons
lessons = parse()
times_parsed = parse_lesson_times()
hols_for_weekdays = []
if smart:
week_days = [monday_of_week + datetime.timedelta(days=i) for i in range(5)]
subs_for_weekday = []
for week_day in week_days:
subs = get_substitutions_by_date_as_dict(week_day)
subs_for_weekday.append(subs)
hols = get_today_holidays(week_day)
hols_for_weekdays.append(hols)
# Init plan array
plan = []
already_added_subs_as_ids = []
# Fill plan array with LessonContainers (show upside), WIDTH and HEIGHT are defined by Django settings
for hour_idx in range(settings.TIMETABLE_HEIGHT):
plan.append(([], times_parsed[hour_idx] if len(times_parsed) > hour_idx else None))
for day_idx in range(settings.TIMETABLE_WIDTH):
plan[hour_idx][0].append(LessonContainer())
# Fill plan with lessons
for lesson in lessons:
for i, element in enumerate(lesson.elements):
# Check if the lesson element is important for that plan (look by type and id)
found = False
if type == TYPE_CLASS:
for lclass in element.classes:
if lclass.id == id:
found = True
elif type == TYPE_TEACHER:
if element.teacher:
if element.teacher.id == id:
found = True
elif type == TYPE_ROOM:
for time in lesson.times:
for j, lroom in enumerate(time.rooms):
if lroom.id == id:
found = True
# If the lesson element is important then add it to plan array
if found:
for time in lesson.times: # Go for every time the lesson is thought
# Find matching rooms
room_index = None
for j, lroom in enumerate(time.rooms):
if lroom.id == id:
room_index = j
# Add the time object to the matching LessonContainer on the right position in the plan array
plan[time.hour - 1][0][time.day - 1].set_time(time)
# Check if there is an room for this time and lesson
try:
room = time.rooms[i]
except IndexError:
room = None
# Smart Plan: Check if there substitutions for this lesson
matching_sub = None
if smart:
# If a sub with matching lesson id and day exists
if subs_for_weekday[time.day - 1].get(lesson.id, None) is not None:
for sub in subs_for_weekday[time.day - 1][lesson.id]:
# ... check whether the sub has the right old teacher and the right lesson number
if sub["sub"].teacher_old is not None and element.teacher is not None:
if sub["sub"].teacher_old.id == element.teacher.id and \
sub["sub"].lesson == time.hour and sub["table"].is_event is False:
matching_sub = sub
# If the lesson matches, add it to the list of already added subs
if matching_sub:
already_added_subs_as_ids.append(matching_sub["sub"].id)
# Create a LessonElementContainer with room and lesson element
element_container = LessonElementContainer(element, room, substitution=matching_sub)
# Important for rooms: Check if the current room is the old room
if smart and matching_sub is not None:
if matching_sub["sub"].room_new is not None:
if matching_sub["sub"].room_old is not None:
if matching_sub["sub"].room_old != matching_sub["sub"].room_new:
element_container.is_old = True
else:
element_container.is_old = True
# The rooms is empty, too, if the lesson is canceled
if matching_sub["sub"].type == TYPE_CANCELLATION:
element_container.is_old = True
# Check for holidays
if smart and hols_for_weekdays[time.day - 1]:
element_container.is_hol = True
element_container.element.holiday_reason = hols_for_weekdays[time.day - 1][0].name
if type != TYPE_ROOM or i == room_index:
# Add this container object to the LessonContainer object in the plan array
plan[time.hour - 1][0][time.day - 1].append(element_container)
# Now check subs which were not in this plan before
if smart:
for i, week_day in enumerate(week_days):
subs_for_this_weekday = subs_for_weekday[i]
for lesson_id, subs in subs_for_this_weekday.items():
for sub in subs:
found = False
room = sub["sub"].room_old
if type == TYPE_CLASS:
if sub["sub"].classes:
for _class in sub["sub"].classes:
if _class.id == id:
found = True
elif type == TYPE_TEACHER:
if sub["sub"].teacher_new:
if sub["sub"].teacher_new.id == id:
found = True
if sub["sub"].teacher_old:
if sub["sub"].teacher_old.id == id:
found = True
elif type == TYPE_ROOM:
if sub["sub"].room_new:
if sub["sub"].room_new.id == id:
found = True
if found:
element_container = LessonElementContainer(sub["sub"].lesson_element, room, substitution=sub)
if sub["sub"].id not in already_added_subs_as_ids:
plan[sub["sub"].lesson - 1][0][i].append(element_container)
# Get all events for this week day
events = get_all_events_by_date(week_day)
event_table = generate_event_table(events)
for event in event_table:
found = False
# Check if event is relevant for type and id
if type == TYPE_CLASS:
for _class in event.event.classes:
if _class.id == id:
found = True
elif type == TYPE_TEACHER:
for teacher in event.teachers:
if teacher.id == id:
found = True
elif type == TYPE_ROOM:
for room in event.rooms:
if room.id == id:
found = True
if found:
# Add event to plan
element_container = LessonElementContainer(None, None,
substitution={"sub": None, "table": event})
for j in range(event.event.from_lesson - 1, event.event.to_lesson):
plan[j][0][i].append(element_container)
cache.update((plan, hols_for_weekdays))
return plan, hols_for_weekdays
from rules import add_perm
from aleksis.core.util.predicates import has_person, has_global_perm
# Do XML import
do_xml_import_predicate = has_person & has_global_perm("untis.do_xml_import")
add_perm("untis.do_xml_import", do_xml_import_predicate)
# Do XML import
assign_subjects_to_groups_predicate = has_person & has_global_perm("untis.assign_subjects_to_groups")
add_perm("untis.assign_subjects_to_groups", assign_subjects_to_groups_predicate)