mirror of
https://codeberg.org/Mo8it/AdvLabDB.git
synced 2024-11-08 21:21:06 +00:00
Small fixes
This commit is contained in:
parent
6d4ac06078
commit
d2ab29b0d3
2 changed files with 5 additions and 8 deletions
|
@ -113,13 +113,12 @@ class Group(db.Model):
|
|||
semester = part_students[0].part.semester
|
||||
program = part_students[0].part.program
|
||||
|
||||
lastTakenGroupNumber = (
|
||||
groupWithHighestNumber = (
|
||||
Group.query.filter(Group.semester == semester, Group.program == program)
|
||||
.order_by(Group.number.desc())
|
||||
.first()
|
||||
.number
|
||||
or 0
|
||||
)
|
||||
lastTakenGroupNumber = (groupWithHighestNumber and groupWithHighestNumber.number) or 0
|
||||
|
||||
return Group(
|
||||
program=program,
|
||||
|
@ -358,14 +357,14 @@ class Semester(db.Model):
|
|||
semester.transferPartsFrom(oldSemester)
|
||||
|
||||
for experiment in Experiment.query.filter(Experiment.active == True):
|
||||
newSemesterExperiment = SemesterExperiment(experiment=experiment, semester=model)
|
||||
newSemesterExperiment = SemesterExperiment(experiment=experiment, semester=semester)
|
||||
|
||||
if transferAssistants:
|
||||
for oldSemesterExperiment in oldSemester.semester_experiments:
|
||||
if oldSemesterExperiment.experiment == experiment:
|
||||
newSemesterExperiment.assistants = oldSemesterExperiment.assistants
|
||||
|
||||
self.session.add(newSemesterExperiment)
|
||||
db.session.add(newSemesterExperiment)
|
||||
|
||||
return semester
|
||||
|
||||
|
|
|
@ -13,9 +13,7 @@ def randomPassword():
|
|||
|
||||
|
||||
def userActiveSemester(flashWarning=False):
|
||||
lastSemesterId = (
|
||||
Semester.query.order_by(Semester.year).order_by(Semester.id.desc()).first().id
|
||||
) # TODO: Check orders
|
||||
lastSemesterId = Semester.query.order_by(Semester.year.desc()).order_by(Semester.id.desc()).first().id
|
||||
if current_user.active_semester_id is None:
|
||||
current_user.active_semester_id = lastSemesterId
|
||||
db.session.commit()
|
||||
|
|
Loading…
Reference in a new issue