2023-01-14 17:38:03 +01:00
|
|
|
from ..base.mode import EnrollmentsMode
|
2022-10-26 10:33:35 +02:00
|
|
|
from ..base.models import Base
|
2023-01-14 17:38:03 +01:00
|
|
|
from ..dependencies import db
|
2022-10-26 10:33:35 +02:00
|
|
|
|
|
|
|
|
|
|
|
class ExaminationSchedule(Base):
|
2023-01-14 17:38:03 +01:00
|
|
|
__tablename__ = "examination_schedules"
|
2022-10-26 10:33:35 +02:00
|
|
|
|
|
|
|
title = db.Column(db.String(100), unique=True, nullable=False)
|
2022-11-17 10:21:36 +01:00
|
|
|
duration_time = db.Column(db.Integer, nullable=False) # in minutes
|
2023-01-14 17:38:03 +01:00
|
|
|
open_enrollments = db.Column(
|
|
|
|
db.String(1), default=EnrollmentsMode.INIT.value, nullable=False
|
|
|
|
)
|
2022-11-12 16:18:07 +01:00
|
|
|
start_date = db.Column(db.DateTime, nullable=False)
|
|
|
|
end_date = db.Column(db.DateTime, nullable=False)
|
2023-01-14 17:38:03 +01:00
|
|
|
year_group_id = db.Column(
|
|
|
|
db.Integer, db.ForeignKey("year_groups.id"), nullable=False
|
|
|
|
)
|
|
|
|
year_group = db.relationship("YearGroup", backref="examination_schedules")
|
2022-11-12 16:18:07 +01:00
|
|
|
|
2022-10-26 10:33:35 +02:00
|
|
|
|
2022-11-12 16:18:07 +01:00
|
|
|
committee = db.Table(
|
|
|
|
"committees",
|
|
|
|
db.Column("term_of_defence_id", db.ForeignKey("term_of_defences.id")),
|
|
|
|
db.Column("project_supervisor_id", db.ForeignKey("project_supervisors.id")),
|
|
|
|
)
|
2022-10-26 10:33:35 +02:00
|
|
|
|
2022-11-12 16:18:07 +01:00
|
|
|
|
|
|
|
class TermOfDefence(Base):
|
2023-01-14 17:38:03 +01:00
|
|
|
__tablename__ = "term_of_defences"
|
2022-10-26 10:33:35 +02:00
|
|
|
|
|
|
|
start_date = db.Column(db.DateTime, nullable=False)
|
|
|
|
end_date = db.Column(db.DateTime, nullable=False)
|
2023-01-14 17:38:03 +01:00
|
|
|
examination_schedule_id = db.Column(
|
|
|
|
db.Integer, db.ForeignKey("examination_schedules.id")
|
|
|
|
)
|
|
|
|
examination_schedule = db.relationship(
|
|
|
|
"ExaminationSchedule", backref="term_of_defences"
|
|
|
|
)
|
|
|
|
group_id = db.Column(db.Integer, db.ForeignKey("groups.id"))
|
|
|
|
group = db.relationship(
|
|
|
|
"Group", uselist=False, backref="term_of_defence", lazy="joined"
|
|
|
|
)
|
|
|
|
members_of_committee = db.relationship(
|
|
|
|
"ProjectSupervisor", secondary=committee, lazy="joined"
|
|
|
|
)
|
|
|
|
chairman_of_committee = db.Column(
|
|
|
|
db.Integer, db.ForeignKey("project_supervisors.id")
|
|
|
|
)
|
2022-10-26 10:33:35 +02:00
|
|
|
|
|
|
|
|
2022-11-12 16:18:07 +01:00
|
|
|
class TemporaryAvailability(Base):
|
2023-01-14 17:38:03 +01:00
|
|
|
__tablename__ = "temporary_availabilities"
|
2022-10-26 10:33:35 +02:00
|
|
|
|
2022-11-12 16:18:07 +01:00
|
|
|
start_date = db.Column(db.DateTime, nullable=False)
|
|
|
|
end_date = db.Column(db.DateTime, nullable=False)
|
2023-01-14 17:38:03 +01:00
|
|
|
examination_schedule_id = db.Column(
|
|
|
|
db.Integer, db.ForeignKey("examination_schedules.id"), nullable=False
|
|
|
|
)
|
|
|
|
examination_schedule = db.relationship(
|
|
|
|
"ExaminationSchedule", backref="temporary_availabilities"
|
|
|
|
)
|
|
|
|
project_supervisor_id = db.Column(
|
|
|
|
db.Integer, db.ForeignKey("project_supervisors.id"), nullable=False
|
|
|
|
)
|
|
|
|
project_supervisor = db.relationship(
|
|
|
|
"ProjectSupervisor", backref="temporary_availabilities"
|
|
|
|
)
|