1
0
Fork 0
mirror of https://codeberg.org/Mo8it/AdvLabDB.git synced 2024-11-08 21:21:06 +00:00

Fixed not using Semester.customInit

This commit is contained in:
Mo 2021-09-11 15:35:13 +02:00
parent 2ac895e047
commit 794b369a33
2 changed files with 7 additions and 4 deletions

View file

@ -414,11 +414,14 @@ class Semester(db.Model):
__table_args__ = (db.UniqueConstraint(label, year),) __table_args__ = (db.UniqueConstraint(label, year),)
def customInit(label, year, oldSemester, transferParts, transferAssistants): def customInit(label, year):
if label not in ("WS", "SS"): if label not in ("WS", "SS"):
raise DataBaseException("The semester label has to be WS or SS!") raise DataBaseException("The semester label has to be WS or SS!")
semester = Semester(label=label, year=year) return Semester(label, year)
def customInit(label, year, oldSemester, transferParts, transferAssistants):
semester = Semester.customInit(label=label, year=year)
if transferParts: if transferParts:
semester.transferPartsFrom(oldSemester) semester.transferPartsFrom(oldSemester)

View file

@ -17,8 +17,8 @@ with app.app_context():
db.session.add(program2) db.session.add(program2)
db.session.add(program3) db.session.add(program3)
sem1 = Semester(label="SS", year=22) sem1 = Semester.customInit(label="SS", year=22)
sem2 = Semester(label="WS", year=22) sem2 = Semester.customInit(label="WS", year=22)
db.session.add(sem1) db.session.add(sem1)
db.session.add(sem2) db.session.add(sem2)