1
0
Fork 0
mirror of https://codeberg.org/Mo8it/AdvLabDB.git synced 2024-09-17 18:31:15 +00:00

Moved number from PartExperiment to Experiment

This commit is contained in:
Mo 2021-03-31 20:43:54 +02:00
parent b76dc82d88
commit 78ce7a6e69
4 changed files with 7 additions and 7 deletions

File diff suppressed because one or more lines are too long

View file

@ -51,6 +51,7 @@ class GroupExperiment(db.Model):
class Experiment(db.Model):
id = db.Column(db.Integer, primary_key=True)
number = db.Column(db.Integer, nullable=False)
name = db.Column(db.String(200), nullable=False)
description = db.Column(db.Text, nullable=True)
room = db.Column(db.String(100), nullable=False)
@ -75,7 +76,6 @@ experiment_assistant = db.Table("experiment_assistant",
class PartExperiment(db.Model):
# An experiment in a specific part
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)
part_id = db.Column(db.Integer, db.ForeignKey("part.id"), nullable=False)
assistants = db.relationship("Assistant", secondary=experiment_assistant, lazy=True,

View file

@ -108,7 +108,7 @@ def groups():
["Students",
"[ps.student.first_name + ' ' + ps.student.last_name for ps in row.part_students]"],
["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:
tablesLabels.append("Part " + part.label + ":")

View file

@ -39,17 +39,17 @@ db.session.add(ps1)
db.session.add(ps2)
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)
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)
db.session.add(ex1)
db.session.add(ex2)
px1 = PartExperiment(number=1, experiment=ex1, part=parta1)
px2 = PartExperiment(number=2, experiment=ex2, part=partb2)
px1 = PartExperiment(experiment=ex1, part=parta1)
px2 = PartExperiment(experiment=ex2, part=partb2)
db.session.add(px1)
db.session.add(px2)