77 lines
2.3 KiB
Python
77 lines
2.3 KiB
Python
# -*- coding: UTF-8 -*
|
|
|
|
"""ScoDoc models: moduleimpls
|
|
"""
|
|
from typing import Any
|
|
|
|
from app import db
|
|
from app.models import APO_CODE_STR_LEN
|
|
from app.models import SHORT_STR_LEN
|
|
from app.models import CODE_STR_LEN
|
|
from app.models import UniteEns, Identite
|
|
|
|
import app.scodoc.notesdb as ndb
|
|
from app.scodoc import sco_evaluation_db
|
|
|
|
|
|
class ModuleImpl(db.Model):
|
|
"""Mise en oeuvre d'un module pour une annee/semestre"""
|
|
|
|
__tablename__ = "notes_moduleimpl"
|
|
__table_args__ = (db.UniqueConstraint("formsemestre_id", "module_id"),)
|
|
|
|
id = db.Column(db.Integer, primary_key=True)
|
|
moduleimpl_id = db.synonym("id")
|
|
module_id = db.Column(
|
|
db.Integer,
|
|
db.ForeignKey("notes_modules.id"),
|
|
)
|
|
formsemestre_id = db.Column(
|
|
db.Integer,
|
|
db.ForeignKey("notes_formsemestre.id"),
|
|
index=True,
|
|
)
|
|
responsable_id = db.Column("responsable_id", db.Integer, db.ForeignKey("user.id"))
|
|
# formule de calcul moyenne:
|
|
computation_expr = db.Column(db.Text())
|
|
|
|
evaluations = db.relationship("Evaluation", lazy="dynamic", backref="moduleimpl")
|
|
|
|
|
|
# Enseignants (chargés de TD ou TP) d'un moduleimpl
|
|
notes_modules_enseignants = db.Table(
|
|
"notes_modules_enseignants",
|
|
db.Column(
|
|
"moduleimpl_id",
|
|
db.Integer,
|
|
db.ForeignKey("notes_moduleimpl.id"),
|
|
),
|
|
db.Column("ens_id", db.Integer, db.ForeignKey("user.id")),
|
|
# ? db.UniqueConstraint("moduleimpl_id", "ens_id"),
|
|
)
|
|
# XXX il manque probablement une relation pour gérer cela
|
|
|
|
|
|
class ModuleImplInscription(db.Model):
|
|
"""Inscription à un module (etudiants,moduleimpl)"""
|
|
|
|
__tablename__ = "notes_moduleimpl_inscription"
|
|
__table_args__ = (db.UniqueConstraint("moduleimpl_id", "etudid"),)
|
|
|
|
id = db.Column(db.Integer, primary_key=True)
|
|
moduleimpl_inscription_id = db.synonym("id")
|
|
moduleimpl_id = db.Column(
|
|
db.Integer,
|
|
db.ForeignKey("notes_moduleimpl.id"),
|
|
index=True,
|
|
)
|
|
etudid = db.Column(db.Integer, db.ForeignKey("identite.id"), index=True)
|
|
etud = db.relationship(
|
|
Identite,
|
|
backref=db.backref("moduleimpl_inscriptions", cascade="all, delete-orphan"),
|
|
)
|
|
moduleimpl = db.relationship(
|
|
ModuleImpl,
|
|
backref=db.backref("inscriptions", cascade="all, delete-orphan"),
|
|
)
|