mirror of
https://codeberg.org/Mo8it/AdvLabDB.git
synced 2024-11-08 21:21:06 +00:00
Moved number from PartExperiment to Experiment
This commit is contained in:
parent
b76dc82d88
commit
78ce7a6e69
4 changed files with 7 additions and 7 deletions
File diff suppressed because one or more lines are too long
|
@ -51,6 +51,7 @@ class GroupExperiment(db.Model):
|
||||||
|
|
||||||
class Experiment(db.Model):
|
class Experiment(db.Model):
|
||||||
id = db.Column(db.Integer, primary_key=True)
|
id = db.Column(db.Integer, primary_key=True)
|
||||||
|
number = db.Column(db.Integer, nullable=False)
|
||||||
name = db.Column(db.String(200), nullable=False)
|
name = db.Column(db.String(200), nullable=False)
|
||||||
description = db.Column(db.Text, nullable=True)
|
description = db.Column(db.Text, nullable=True)
|
||||||
room = db.Column(db.String(100), nullable=False)
|
room = db.Column(db.String(100), nullable=False)
|
||||||
|
@ -75,7 +76,6 @@ experiment_assistant = db.Table("experiment_assistant",
|
||||||
class PartExperiment(db.Model):
|
class PartExperiment(db.Model):
|
||||||
# An experiment in a specific part
|
# An experiment in a specific part
|
||||||
id = db.Column(db.Integer, primary_key=True)
|
id = db.Column(db.Integer, primary_key=True)
|
||||||
number = db.Column(db.Integer, nullable=False)
|
|
||||||
experiment_id = db.Column(db.Integer, db.ForeignKey("experiment.id"), nullable=False)
|
experiment_id = db.Column(db.Integer, db.ForeignKey("experiment.id"), nullable=False)
|
||||||
part_id = db.Column(db.Integer, db.ForeignKey("part.id"), nullable=False)
|
part_id = db.Column(db.Integer, db.ForeignKey("part.id"), nullable=False)
|
||||||
assistants = db.relationship("Assistant", secondary=experiment_assistant, lazy=True,
|
assistants = db.relationship("Assistant", secondary=experiment_assistant, lazy=True,
|
||||||
|
|
|
@ -108,7 +108,7 @@ def groups():
|
||||||
["Students",
|
["Students",
|
||||||
"[ps.student.first_name + ' ' + ps.student.last_name for ps in row.part_students]"],
|
"[ps.student.first_name + ' ' + ps.student.last_name for ps in row.part_students]"],
|
||||||
["Experiments (appointments)",
|
["Experiments (appointments)",
|
||||||
"[str(gx.part_experiment.number) + ' (' + str([appointmentDate(a.date) for a in gx.appointments]) + ')' for gx in row.group_experiments]"]]
|
"[str(gx.part_experiment.experiment.number) + ' (' + str([appointmentDate(a.date) for a in gx.appointments]) + ')' for gx in row.group_experiments]"]]
|
||||||
|
|
||||||
for part in parts:
|
for part in parts:
|
||||||
tablesLabels.append("Part " + part.label + ":")
|
tablesLabels.append("Part " + part.label + ":")
|
||||||
|
|
|
@ -39,17 +39,17 @@ db.session.add(ps1)
|
||||||
db.session.add(ps2)
|
db.session.add(ps2)
|
||||||
db.session.add(ps3)
|
db.session.add(ps3)
|
||||||
|
|
||||||
ex1 = Experiment(name="exp", room="123", building="phy", responsibility="none", duration_in_days=2,
|
ex1 = Experiment(number=1, name="exp", room="123", building="phy", responsibility="none", duration_in_days=2,
|
||||||
oral_weighting=0.5, protocol_weighting=0.5, final_weighting=1)
|
oral_weighting=0.5, protocol_weighting=0.5, final_weighting=1)
|
||||||
|
|
||||||
ex2 = Experiment(name="exp2", room="123", building="phy", responsibility="none", duration_in_days=2,
|
ex2 = Experiment(number=2, name="exp2", room="123", building="phy", responsibility="none", duration_in_days=2,
|
||||||
oral_weighting=0.5, protocol_weighting=0.5, final_weighting=1)
|
oral_weighting=0.5, protocol_weighting=0.5, final_weighting=1)
|
||||||
|
|
||||||
db.session.add(ex1)
|
db.session.add(ex1)
|
||||||
db.session.add(ex2)
|
db.session.add(ex2)
|
||||||
|
|
||||||
px1 = PartExperiment(number=1, experiment=ex1, part=parta1)
|
px1 = PartExperiment(experiment=ex1, part=parta1)
|
||||||
px2 = PartExperiment(number=2, experiment=ex2, part=partb2)
|
px2 = PartExperiment(experiment=ex2, part=partb2)
|
||||||
|
|
||||||
db.session.add(px1)
|
db.session.add(px1)
|
||||||
db.session.add(px2)
|
db.session.add(px2)
|
||||||
|
|
Loading…
Reference in a new issue