From d30945461b49c69a01fc20c4bdd59b1cc6455ad6 Mon Sep 17 00:00:00 2001 From: Mo8it Date: Thu, 1 Jul 2021 14:41:20 +0200 Subject: [PATCH] Changed PartExperiment to SemesterExperiment --- DB.drawio | 2 +- advlabdb/modelViews.py | 75 +++++++++++++++++++----------------------- advlabdb/models.py | 28 +++++++++------- config.json | 2 +- testDB.py | 20 +++++------ 5 files changed, 63 insertions(+), 64 deletions(-) diff --git a/DB.drawio b/DB.drawio index f84c1d6..472e018 100644 --- a/DB.drawio +++ b/DB.drawio @@ -1 +1 @@ -7Z1dd9pI0oB/Tc7ZvfAc9Am6jB3HMxNnNrFnN8nc+MggjGKBiBCxnV+/EkgCugshUEtdcteed/c1MsgdqupRdVV11RvjYvp8Fbnzycdw5AVv9N7o+Y3x7o2ua9rASv5feuVlfcXu6+sLD5E/yt60uXDr//Kyi73s6tIfeYudN8ZhGMT+fPfiMJzNvGG8c82NovBp923jMNj9q3P3weMu3A7dgL/6xR/Fk+yq3ettfvG75z9M8j+t57+Zuvm7swuLiTsKn7YuGZdvjIsoDOP1T9PnCy9Iv738i1l/7v2e3xYri7xZXOUDf8zfD9zIHY8/zh5uh/ffbi4Hf51ld/npBsvsX7yIl6P0jus1xy/5N5Esf57+GLv36aXzRexGcSYwo5dcSEQQu/7Mi5IL2up1ELjzhb96+/rKxA9G1+5LuIzzG+Wvzsf+sze6WcsrfW8iuuvkZunL9Obj5Oa32WLSX7uB/zBLfh4mS03/4nnkLZK1XLuLOHvH2A+CizAIo9XyjXP9wnl7vlp3FD56W7/pDwZv3xrZ39i6btqmY71LrvNfdP6teVHsPW9dyr74Ky+cenH0krwl+22hFZkZmNnLp41OFdcmW+pk5BfdTI8filtvJJ38kAn7CMHrnOD3Sjz5l8e+G9wk9uXOHlbC35VtKqBRFM7/dqMHL84uzEM/Fc3lz+RbK6S4JZNZOEvvFIfz7JeBN84/ex/GcTjNNSH7Ooqbrr4K6zz5v+TLuej9Zr1JxKRfJK+1zeuV5OZhlEh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Jm7o3EVviT/+EtjzePtkLybO6ARjxSz7fAL6lWSZgm27MGtzhvoHDktOnNYtziZXdr71HSKDINyDwfhuN3YYbXpnq/uoPWUL1b1tVG+DWlHU33Rr+z/b5O5nVL9ZBWJWRdaNUzezqm3ugp6SYqmHcTdZwtrynp2di+WJyrtRrG+Tg0EeWzp7p0E5L0kcwXhf/3a9lfvLjxdqR/8b+t5yOoujHmrvYZle3cVXtPOL/u/uy/WZN5w40zcC2lpVmMcY0BpPgQ5BsWogkGclciileJbHmjzO5RNrTaZeF8h04DklQbxh55OXxI04SPBplsvbD2tMXK4OyUU/3O7y4INrPwb29EQ1vdioHyInyHyMfzobPV/bDx/OOa2DLJvRH2RGvm3FFmDFIkI0V0vz0VR+fvjxyR5chH+/jZefJqclyoBbOch4zE4R1z4Q9DNS73KvQ5KEDPbzofQ+ryI6dMbBMFlHuXQUZsDcSKmNQaDGq4dpPBxzEKHt69+9G32veHA3DW+jUfjIjdhV1P6xcUdFYe5klnzsVg887g12sJFHS2yw4+r7F+t5oX+dX/0YuzdD3QtO705LJHGbsUBxB+cPsdsmnzcWEHgEZaIc5o42eWyeicfp7GH3smbYN5gt8qCukCNj7rq+zwqZD4iO/7vzwcOP6Z/Ll1vz6WfEMW354wcuzw96FvaOeRYeaL9N2mKWZNv7MLTKbg6behaabOsKtqtAaRtkbtRnb3S08xe9DHw/3H57tPGbfPZHTvyO/wM= \ No newline at end of file diff --git a/advlabdb/modelViews.py b/advlabdb/modelViews.py index ecf2f14..072772d 100644 --- a/advlabdb/modelViews.py +++ b/advlabdb/modelViews.py @@ -20,7 +20,7 @@ from advlabdb.models import ( Group, GroupExperiment, Part, - PartExperiment, + SemesterExperiment, PartStudent, Role, Semester, @@ -106,7 +106,7 @@ class SemesterView(SecureModelView): can_edit = False column_list = ["label", "parts"] - form_columns = ["semester_label", "year", "create_parts", "transfer_assistants"] + form_columns = ["semester_label", "year", "transfer_parts", "transfer_semester_experiments", "transfer_assistants"] semesterLabels = ["WS", "SS"] form_extra_fields = { @@ -114,13 +114,14 @@ class SemesterView(SecureModelView): "Semester", choices=list(zip(semesterLabels, semesterLabels)), validators=[DataRequired()] ), "year": TextField("Year", validators=[DataRequired()]), - "create_parts": BooleanField( - "Create parts:" - + ", ".join(getConfig("partLabels")) - + " and transfer part experiments from your current active semester:", + "transfer_parts": BooleanField( + "Transfer parts from your current semester", default=True, ), - "transfer_assistants": BooleanField("Transfer Assistants from your current active semester:", default=False), + "transfer_semester_experiments": BooleanField( + "Transfer Semester Experiemnts from your current semester", default=True + ), + "transfer_assistants": BooleanField("Transfer Assistants from your current active semester", default=True), } def create_model(self, form): @@ -147,22 +148,22 @@ class SemesterView(SecureModelView): ) ) - oldSemesterParts = userActiveSemester().parts + oldSemester = userActiveSemester() setUserActiveSemester(model.id) - if form.create_parts.data: - model.createParts() + if form.transfer_parts.data: + model.transferParts(oldSemester) + if form.transfer_semester_experiments.data: try: - for part in oldSemesterParts: - for partExperiment in part.part_experiments: - newPartExperiment = PartExperiment( - experiment=partExperiment.experiment, part=partFromLabelInUserActiveSemester(part.label) - ) - if form.transfer_assistants.data: - newPartExperiment.assistants = partExperiment.assistants - self.session.add(newPartExperiment) + for semesterExperiment in oldSemester.semester_experiments: + newSemesterExperiment = SemesterExperiment( + experiment=semesterExperiment.experiment, semester=userActiveSemester() + ) + if form.transfer_assistants.data: + newSemesterExperiment.assistants = semesterExperiment.assistants + self.session.add(newSemesterExperiment) self.session.commit() except Exception as ex: flash(ex, "error") @@ -172,12 +173,9 @@ class SemesterView(SecureModelView): class PartView(SecureModelView): can_view_details = True - column_details_list = ["label", "semester", "part_experiments", "part_students", "groups"] + column_details_list = ["label", "semester", "part_students", "groups"] form_columns = ["label", "semester"] - partLabels = getConfig("partLabels") - form_choices = {"label": list(zip(partLabels, partLabels))} - def get_query(self): return super().get_query().filter(Part.id.in_([part.id for part in userActiveSemester().parts])) @@ -337,26 +335,23 @@ class ExperimentView(SecureModelView): column_list = ["number", "name", "deprecated"] -class PartExperimentView(SecureModelView): - column_list = ["experiment", "part", "assistants"] - - partLabels = getConfig("partLabels") - column_filters = ["part"] +class SemesterExperimentView(SecureModelView): + column_list = ["experiment", "semester", "assistants"] def get_query(self): - return super().get_query().filter(PartExperiment.part_id.in_([part.id for part in userActiveSemester().parts])) + return super().get_query().filter(SemesterExperiment.semester == userActiveSemester()) def get_count_query(self): return ( self.session.query(func.count("*")) .select_from(self.model) - .filter(PartExperiment.part_id.in_([part.id for part in userActiveSemester().parts])) + .filter(SemesterExperiment.semester == userActiveSemester()) ) class AssistantView(SecureModelView): can_view_details = True - column_list = ["first_name", "last_name", "email", "user", "part_experiments"] + column_list = ["first_name", "last_name", "email", "user", "semester_experiments"] column_details_list = column_list + [ "phone_number", "mobile_phone_number", @@ -371,10 +366,8 @@ class AssistantView(SecureModelView): class GroupExperimentView(SecureModelView): class CreateForm(Form): - def partExperimentQueryFactory(): - return PartExperiment.query.filter( - PartExperiment.part_id.in_([part.id for part in userActiveSemester().parts]) - ) + def semesterExperimentQueryFactory(): + return SemesterExperiment.query.filter(SemesterExperiment.semester == userActiveSemester()) def assistantQueryFactory(): return Assistant.query.filter( @@ -384,9 +377,9 @@ class GroupExperimentView(SecureModelView): group = QuerySelectField( "Group", query_factory=groupQueryFactory, validators=[DataRequired()], allow_blank=True, blank_text="-" ) - part_experiment = QuerySelectField( - "Part Experiment", - query_factory=partExperimentQueryFactory, + semester_experiment = QuerySelectField( + "Semester Experiment", + query_factory=semesterExperimentQueryFactory, validators=[DataRequired()], allow_blank=True, blank_text="-", @@ -414,8 +407,8 @@ class GroupExperimentView(SecureModelView): form = CreateForm - column_list = ["group", "part_experiment", "appointments", "experiment_marks"] - column_filters = ["group", "part_experiment.experiment", "appointments"] + column_list = ["group", "semester_experiment", "appointments", "experiment_marks"] + column_filters = ["group", "semester_experiment.experiment", "appointments"] def get_query(self): return ( @@ -455,7 +448,7 @@ admin.add_view(PartStudentView(PartStudent, db.session)) admin.add_view(GroupView(Group, db.session)) admin.add_view(GroupExperimentView(GroupExperiment, db.session)) admin.add_view(ExperimentView(Experiment, db.session)) -admin.add_view(PartExperimentView(PartExperiment, db.session)) +admin.add_view(SemesterExperimentView(SemesterExperiment, db.session)) admin.add_view(AssistantView(Assistant, db.session)) admin.add_view(AppointmentView(Appointment, db.session)) admin.add_view(PartView(Part, db.session)) @@ -465,7 +458,7 @@ admin.add_view(UserView(User, db.session)) admin.add_view(RoleView(Role, db.session)) with app.app_context(): - semesters = Semester.query.all()[::-1] + semesters = Semester.query.order_by(Semester.id) for semester in semesters: admin.add_link( MenuLink( diff --git a/advlabdb/models.py b/advlabdb/models.py index fb1d347..9c66913 100644 --- a/advlabdb/models.py +++ b/advlabdb/models.py @@ -58,7 +58,7 @@ class Group(db.Model): class GroupExperiment(db.Model): # An experiment specified to a group id = db.Column(db.Integer, primary_key=True) - part_experiment_id = db.Column(db.Integer, db.ForeignKey("part_experiment.id"), nullable=False) + semester_experiment_id = db.Column(db.Integer, db.ForeignKey("semester_experiment.id"), nullable=False) group_id = db.Column(db.Integer, db.ForeignKey("group.id"), nullable=False) appointments = db.relationship("Appointment", backref="group_experiment", lazy=True) experiment_marks = db.relationship("ExperimentMark", backref="group_experiment", lazy=True) @@ -78,29 +78,29 @@ class Experiment(db.Model): oral_weighting = db.Column(db.Float, nullable=False) protocol_weighting = db.Column(db.Float, nullable=False) final_weighting = db.Column(db.Float, nullable=False) - part_experiments = db.relationship("PartExperiment", backref="experiment", lazy=True) + semester_experiments = db.relationship("SemesterExperiment", backref="experiment", lazy=True) def __repr__(self): return f"" -# Helper table for the many to many relationship between Assistant and PartExperiment +# Helper table for the many to many relationship between Assistant and SemesterExperiment experiment_assistant = db.Table( "experiment_assistant", - db.Column("part_experiment_id", db.Integer, db.ForeignKey("part_experiment.id"), primary_key=True), + db.Column("semester_experiment_id", db.Integer, db.ForeignKey("semester_experiment.id"), primary_key=True), db.Column("assistant_id", db.Integer, db.ForeignKey("assistant.id"), primary_key=True), ) -class PartExperiment(db.Model): +class SemesterExperiment(db.Model): # An experiment in a specific part id = db.Column(db.Integer, primary_key=True) experiment_id = db.Column(db.Integer, db.ForeignKey("experiment.id"), nullable=False) - part_id = db.Column(db.Integer, db.ForeignKey("part.id"), nullable=False) + semester_id = db.Column(db.Integer, db.ForeignKey("semester.id"), nullable=False) assistants = db.relationship( - "Assistant", secondary=experiment_assistant, lazy=True, backref=db.backref("part_experiments", lazy=True) + "Assistant", secondary=experiment_assistant, lazy=True, backref=db.backref("semester_experiments", lazy=True) ) - group_experiments = db.relationship("GroupExperiment", backref="part_experiment", lazy=True) + group_experiments = db.relationship("GroupExperiment", backref="semester_experiment", lazy=True) class Assistant(db.Model): @@ -132,7 +132,6 @@ class Part(db.Model): id = db.Column(db.Integer, primary_key=True) label = db.Column(db.String(100), nullable=False) # A/1, A/2, B/1, B/2 semester_id = db.Column(db.Integer, db.ForeignKey("semester.id"), nullable=False) - part_experiments = db.relationship("PartExperiment", backref="part", lazy=True) part_students = db.relationship("PartStudent", backref="part", lazy=True) groups = db.relationship("Group", backref="part", lazy=True) @@ -144,14 +143,21 @@ class Semester(db.Model): id = db.Column(db.Integer, primary_key=True) label = db.Column(db.String(100), nullable=False, unique=True) # WS2122 for example parts = db.relationship("Part", backref="semester", lazy=True) + semester_experiments = db.relationship("SemesterExperiment", backref="semester", lazy=True) def __repr__(self): return f"<{self.label}>" - def createParts(self): + def transferParts(self, oldSemester): try: - for partLabel in getConfig("partLabels"): + if oldSemester: + partLabels = [part.label for part in oldSemester.parts] + else: + partLabels = getConfig("defaultPartLabels") + + for partLabel in partLabels: db.session.add(Part(label=partLabel, semester=self)) + db.session.commit() except Exception as ex: flash(ex, "error") diff --git a/config.json b/config.json index 2848710..a1f6b90 100644 --- a/config.json +++ b/config.json @@ -1,5 +1,5 @@ { - "partLabels": [ + "defaultPartLabels": [ "A/1", "A/2", "A/m", diff --git a/testDB.py b/testDB.py index 2396553..2f8a295 100644 --- a/testDB.py +++ b/testDB.py @@ -15,8 +15,8 @@ with app.app_context(): db.session.add(sem1) db.session.add(sem2) - sem1.createParts() - sem2.createParts() + sem1.transferParts(None) + sem2.transferParts(None) parta1 = sem2.parts[0] partb2 = sem2.parts[1] @@ -70,14 +70,14 @@ with app.app_context(): db.session.add(ex1) db.session.add(ex2) - px1 = PartExperiment(experiment=ex1, part=parta1) - px2 = PartExperiment(experiment=ex2, part=partb2) + sx1 = SemesterExperiment(experiment=ex1, semester=sem2) + sx2 = SemesterExperiment(experiment=ex2, semester=sem2) - db.session.add(px1) - db.session.add(px2) + db.session.add(sx1) + db.session.add(sx2) - gx1 = GroupExperiment(part_experiment=px1, group=g1) - gx2 = GroupExperiment(part_experiment=px2, group=g2) + gx1 = GroupExperiment(semester_experiment=sx1, group=g1) + gx2 = GroupExperiment(semester_experiment=sx2, group=g2) db.session.add(gx1) db.session.add(gx2) @@ -100,8 +100,8 @@ with app.app_context(): ) as2 = Assistant(first_name="As2", last_name="l", email="test2@test.com", user=us2) - as1.part_experiments.append(px1) - as2.part_experiments.append(px2) + as1.semester_experiments.append(sx1) + as2.semester_experiments.append(sx2) db.session.add(as1) db.session.add(as2)