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

Fix calling execute

This commit is contained in:
Mo 2022-05-21 21:12:15 +02:00
parent 7759a144b2
commit 5a3125d1d1
2 changed files with 5 additions and 5 deletions

View file

@ -474,7 +474,7 @@ class PartRowFilter(FilterEqual):
if not has_request_context():
return tuple()
parts = db.execute(select(Part).where(Part.semester == current_user.active_semester)).scalars()
parts = db.session.execute(select(Part).where(Part.semester == current_user.active_semester)).scalars()
return tuple((part.id, f"{part.program.repr()}{part.number}") for part in parts)
@ -576,7 +576,7 @@ class ProgramRowFilter(FilterEqual):
if not has_request_context():
return tuple()
programs = db.execute(select(Program)).scalars()
programs = db.session.execute(select(Program)).scalars()
return tuple((program.id, program.repr()) for program in programs)
@ -931,7 +931,7 @@ class ExperimentRowFilter(FilterEqual):
if not has_request_context():
return tuple()
activeExperiments = db.execute(select(Experiment).where(Experiment.active == True)).scalars()
activeExperiments = db.session.execute(select(Experiment).where(Experiment.active == True)).scalars()
return tuple(
(
f"{activeExperiment.number},{activeExperiment.program_id}",
@ -1211,7 +1211,7 @@ class ExperimentMarkView(SecureAdminModelView):
if not has_request_context():
return tuple()
admins = db.execute(select(Admin).join(User).where(User.active == True)).scalars()
admins = db.session.execute(select(Admin).join(User).where(User.active == True)).scalars()
return tuple((admin.id, admin.repr()) for admin in admins)
def apply(self, query, value, alias=None):

View file

@ -464,7 +464,7 @@ class Semester(db.Model):
if transferParts:
semester.transferPartsFrom(oldSemester)
for experiment in db.execute(select(Experiment).where(Experiment.active == True)).scalars():
for experiment in db.session.execute(select(Experiment).where(Experiment.active == True)).scalars():
newSemesterExperiment = SemesterExperiment(experiment=experiment, semester=semester)
if transferAssistants: