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:
parent
2ac895e047
commit
794b369a33
2 changed files with 7 additions and 4 deletions
|
@ -414,11 +414,14 @@ class Semester(db.Model):
|
|||
|
||||
__table_args__ = (db.UniqueConstraint(label, year),)
|
||||
|
||||
def customInit(label, year, oldSemester, transferParts, transferAssistants):
|
||||
def customInit(label, year):
|
||||
if label not in ("WS", "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:
|
||||
semester.transferPartsFrom(oldSemester)
|
||||
|
|
|
@ -17,8 +17,8 @@ with app.app_context():
|
|||
db.session.add(program2)
|
||||
db.session.add(program3)
|
||||
|
||||
sem1 = Semester(label="SS", year=22)
|
||||
sem2 = Semester(label="WS", year=22)
|
||||
sem1 = Semester.customInit(label="SS", year=22)
|
||||
sem2 = Semester.customInit(label="WS", year=22)
|
||||
|
||||
db.session.add(sem1)
|
||||
db.session.add(sem2)
|
||||
|
|
Loading…
Reference in a new issue