From 605edeecca68798ebd90578c4592b19f92328179 Mon Sep 17 00:00:00 2001 From: Mo8it Date: Tue, 13 Jul 2021 21:49:44 +0200 Subject: [PATCH] Big changes to the database, mainly due to adding Program --- DB.drawio | 2 +- advlabdb/modelViews.py | 8 +++- advlabdb/models.py | 92 ++++++++++++++++++++++++++++++------------ config.json | 9 ----- testDB.py | 11 ++++- 5 files changed, 84 insertions(+), 38 deletions(-) delete mode 100644 config.json diff --git a/DB.drawio b/DB.drawio index 98b81e9..cedeb55 100644 --- a/DB.drawio +++ b/DB.drawio @@ -1 +1 @@ -7Z1bc5tasoB/javOPHgXV0k8+hbv7Dh7Enufk2S/qJCELGIkFEC+5NcfkABJrAYhsYDGq6dmpixZwit090ev7l7dZ+rV/PXWM5ezz+7Ecs4UafJ6pl6fKYqsKcpZ9F9p8rZ5ZyD1Nm88evYk/tD2jQf7txW/KcXvruyJ5e99MHBdJ7CX+2+O3cXCGgd775me577sf2zqOvt/dWk+WswbD2PTYd/9Zk+CWfxuT5K2v/jTsh9nyZ9Wkt/MzeTT8Rv+zJy4LztvqTdn6pXnusHmp/nrleVEdy+5MZvvfcj5bboyz1oEZb7wcflhYHrmdPp58fgwHv24vxn8fR5f5dl0VvG/2A9Wk+iKmzUHb8mdCJe/jH4MzFH01qUfmF4QC0yVwjdCEQSmvbC88A15/dpxzKVvrz++eWdmO5M7881dBcmFkleXU/vVmtxv5BV9NhTdXXix6GV08Wl48Yd4MdGvTcd+XIQ/j8OlRn/x0rP8cC13ph/En5jajnPlOq63Xr56qVwZF5frdXvuk7Xzm/5gcHGhxn9j532tpxn6dfg+e6OTu2Z5gfW681Z8428td24F3lv4kfi3qVbEZqDFL1+2OpW+N9tRJzV504z1+DG99FbS4Q+xsI8QvMIIPlfi4b88sE3nPrQvc/G4Fv6+bCMBTTx3+Y/pPVpB/MbStSPR3DyHdy2V4o5MFu4iulLgLuNfOtY0+e7IDQJ3nmhCfDvSi65vhX4Z/je8OVfSH/pZKCblKnwtb1+vJbd0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YHv5bfnlimPNVIeVZWAuAVlUQwBWxm2tcwBOv/mylzmPDZd9Oo5i96CpEdIG9pLoaOjGTLrEbQYPBEo4OQ6mffISqgF0SiDjZCjl4Hvh8ezeWCvF5/8WZwcdfv/ \ No newline at end of file diff --git a/advlabdb/modelViews.py b/advlabdb/modelViews.py index 2f32309..2839c52 100644 --- a/advlabdb/modelViews.py +++ b/advlabdb/modelViews.py @@ -489,7 +489,13 @@ class AppointmentView(SecureModelView): form = CreateForm - column_filters = ["date", "special", "group_experiment.group", "group_experiment.group.part", "assistant"] + column_filters = [ + "date", + "special", + "group_experiment.group", + "group_experiment.semester_experiment.experiment", + "assistant", + ] def queryFilter(self): return Appointment.group_experiment_id.in_( diff --git a/advlabdb/models.py b/advlabdb/models.py index 75b8eb7..0ac3f39 100644 --- a/advlabdb/models.py +++ b/advlabdb/models.py @@ -25,6 +25,7 @@ class Student(db.Model): bachelor_thesis = db.Column(db.String, nullable=True) bachelor_thesis_work_group = db.Column(db.String, nullable=True) note = db.Column(db.Text, nullable=True) + part_students = db.relationship("PartStudent", backref="student", lazy=True) def repr(self): @@ -43,9 +44,11 @@ class PartStudent(db.Model): db.CheckConstraint("final_part_mark < 16"), nullable=True, ) + student_id = db.Column(db.Integer, db.ForeignKey("student.id"), nullable=False) part_id = db.Column(db.Integer, db.ForeignKey("part.id"), nullable=False) group_id = db.Column(db.Integer, db.ForeignKey("group.id"), nullable=True) + experiment_marks = db.relationship("ExperimentMark", backref="part_student", lazy=True) __table_args__ = ( @@ -63,24 +66,28 @@ class PartStudent(db.Model): class Group(db.Model): id = db.Column(db.Integer, primary_key=True) number = db.Column(db.Integer, db.CheckConstraint("number > 0"), 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) + program_id = db.Column(db.Integer, db.ForeignKey("program.id", nullable=False)) + part_students = db.relationship("PartStudent", backref="group", lazy=True) group_experiments = db.relationship("GroupExperiment", backref="group", lazy=True) - __table_args__ = (db.UniqueConstraint(number, part_id),) + __table_args__ = (db.UniqueConstraint(number, semester_id, program_id),) - def customInit(part, partStudents): - orderedPartGroups = Group.query.filter(Group.part == part).order_by(Group.number) - lastTakenGroupNumber = orderedPartGroups[-1].number if orderedPartGroups.count() > 0 else 0 + def customInit(semester, program, partStudents): + orderedGroups = Group.query.filter(Group.semester == semester, Group.program == program).order_by(Group.number) + lastTakenGroupNumber = orderedGroups[-1].number if orderedPartGroups.count() > 0 else 0 return Group( + program=program, number=lastTakenGroupNumber + 1, part_students=partStudents, - part=part, + semester=semester, ) def repr(self): - return f"{self.number} {self.part.repr()}" + return f"{self.number} {self.program.repr()} {self.semester.repr()}" def __repr__(self): return f"" @@ -89,8 +96,10 @@ class Group(db.Model): class GroupExperiment(db.Model): # An experiment specified to a group id = db.Column(db.Integer, primary_key=True) + 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) @@ -126,15 +135,16 @@ class GroupExperiment(db.Model): class Experiment(db.Model): id = db.Column(db.Integer, primary_key=True) - label = db.Column(db.String(20), nullable=False, unique=True) + number = db.Column(db.Integer, db.CheckConstraint("number > 0"), nullable=False) title = db.Column(db.String(200), nullable=False) description = db.Column(db.Text, nullable=True) - wiki_link = db.Column(db.String(200), nullable=True) + wiki_link = db.Column(db.String(300), nullable=True) room = db.Column(db.String(100), nullable=False) building = db.Column(db.String(100), nullable=False) responsibility = db.Column(db.String(200), nullable=True) duration_in_days = db.Column(db.Integer, db.CheckConstraint("duration_in_days > -1"), nullable=False) active = db.Column(db.Boolean, default=True, nullable=False) + oral_weighting = db.Column( db.Float, db.CheckConstraint("oral_weighting >= 0"), db.CheckConstraint("oral_weighting <= 1"), nullable=False ) @@ -147,10 +157,15 @@ class Experiment(db.Model): final_weighting = db.Column( db.Float, db.CheckConstraint("final_weighting >= 0"), db.CheckConstraint("final_weightin <= 1"), nullable=False ) + + program_id = db.Column(db.Integer, db.ForeignKey("program.id"), nullable=False) + semester_experiments = db.relationship("SemesterExperiment", backref="experiment", lazy=True) + __table_args__ = (db.UniqueConstraint(number, program_id),) + def repr(self): - return f"{self.label}" + return f"{self.number} {self.program.repr()}" def __repr__(self): return f"" @@ -167,8 +182,10 @@ experiment_assistant = db.Table( class SemesterExperiment(db.Model): # An experiment in a specific semester id = db.Column(db.Integer, primary_key=True) + experiment_id = db.Column(db.Integer, db.ForeignKey("experiment.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("semester_experiments", lazy=True) ) @@ -191,7 +208,9 @@ class Assistant(db.Model): mobile_phone_number = db.Column(db.String(50), nullable=True) room = db.Column(db.String(100), nullable=True) building = db.Column(db.String(100), nullable=True) + user_id = db.Column(db.Integer, db.ForeignKey("user.id"), nullable=False, unique=True) + appointments = db.relationship("Appointment", backref="assistant", lazy=True) experiment_marks = db.relationship("ExperimentMark", backref="assistant", lazy=True) @@ -206,6 +225,7 @@ class Appointment(db.Model): id = db.Column(db.Integer, primary_key=True) date = db.Column(db.Date, nullable=False) # To be specified with the python package "datetime" special = db.Column(db.Boolean, default=False, nullable=False) # In the break or not + group_experiment_id = db.Column(db.Integer, db.ForeignKey("group_experiment.id"), nullable=False) assistant_id = db.Column(db.Integer, db.ForeignKey("assistant.id"), nullable=False) @@ -256,15 +276,17 @@ class Appointment(db.Model): 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_students = db.relationship("PartStudent", backref="part", lazy=True) - groups = db.relationship("Group", backref="part", lazy=True) + number = db.Column(db.Integer, db.CheckConstraint("number > 0"), nullable=False) - __table_args__ = (db.UniqueConstraint(label, semester_id),) + program_id = db.Column(db.Integer, db.ForeignKey("program.id"), nullable=True) + semester_id = db.Column(db.Integer, db.ForeignKey("semester.id"), nullable=False) + + part_students = db.relationship("PartStudent", backref="part", lazy=True) + + __table_args__ = (db.UniqueConstraint(program_id, number, semester_id),) def repr(self): - return f"{self.label} {self.semester.repr()}" + return f"{self.program.repr()}{self.number} {self.semester.repr()}" def __repr__(self): return f"" @@ -272,37 +294,40 @@ class Part(db.Model): 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 + label = db.Column(db.String(10), nullable=False) + year = db.Column(db.Integer, db.CheckConstraint("year > 0"), db.CheckConstraint("year < 100"), nullalbe=False) + parts = db.relationship("Part", backref="semester", lazy=True) semester_experiments = db.relationship("SemesterExperiment", backref="semester", lazy=True) active_users = db.relationship("User", backref="active_semester", lazy=True) + groups = db.relationship("Group", backref="semester", lazy=True) + + __table_args__ = (db.UniqueConstraint(label, year),) def repr(self): - return f"{self.label}" + return f"{self.label}{self.year}" def __repr__(self): return f"" def transferPartsFrom(self, oldSemester): - 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)) + for part in oldSemester.parts: + db.session.add(Part(program=part.program, number=part.number, semester=self)) class ExperimentMark(db.Model): # A mark for a student after a specific experiment id = db.Column(db.Integer, primary_key=True) + oral_mark = db.Column( db.Integer, db.CheckConstraint("oral_mark > -1"), db.CheckConstraint("oral_mark < 16"), nullable=True ) protocol_mark = db.Column( db.Integer, db.CheckConstraint("protocol_mark > -1"), db.CheckConstraint("protocol_mark < 16"), nullable=True ) + edited_by_admin = db.Column(db.Boolean, default=False, nullable=True) + part_student_id = db.Column(db.Integer, db.ForeignKey("part_student.id"), nullable=False) group_experiment_id = db.Column(db.Integer, db.ForeignKey("group_experiment.id"), nullable=False) assistant_id = db.Column( @@ -319,9 +344,10 @@ class ExperimentMark(db.Model): class User(db.Model, FsUserMixin): - assistant = db.relationship("Assistant", backref="user", lazy=True, uselist=False) active_semester_id = db.Column(db.Integer, db.ForeignKey("semester.id"), nullable=True) + assistant = db.relationship("Assistant", backref="user", lazy=True, uselist=False) + def repr(self): return f"{self.email}" @@ -335,3 +361,17 @@ class Role(db.Model, FsRoleMixin): def __repr__(self): return f"" + + +class Program(db.Model): + label = db.Column(db.String(25), nullable=False) + + parts = db.relationship("Part", backref="program", lazy=True) + experiments = db.relationship("Experiment", backref="program", lazy=True) + groups = db.relationship("Group", backref="program", lazy=True) + + def repr(self): + return f"{self.label}" + + def __repr__(self): + return f"" diff --git a/config.json b/config.json deleted file mode 100644 index a1f6b90..0000000 --- a/config.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "defaultPartLabels": [ - "A/1", - "A/2", - "A/m", - "B/1", - "B/2" - ] -} \ No newline at end of file diff --git a/testDB.py b/testDB.py index bdc582a..39d3e9c 100644 --- a/testDB.py +++ b/testDB.py @@ -15,7 +15,16 @@ with app.app_context(): db.session.add(sem1) db.session.add(sem2) - sem1.transferPartsFrom(None) + partKwargs = [ + {"label": "BS", "number": 1}, + {"label": "BS", "number": 2}, + {"label": "BE", "number": 1}, + {"label": "MS", "number": 1}, + {"label": "MS", "number": 2}, + ] + for kwargs in partKwargs: + db.session.add(Part(semester=sem1, **kwargs)) + sem2.transferPartsFrom(sem1) parta1 = sem2.parts[0]