This commit is contained in:
Emmanuel Viennet 2022-04-26 06:02:17 +02:00
parent ca3336e9be
commit 6d06242cbb
3 changed files with 23 additions and 10 deletions

View File

@ -6,8 +6,6 @@
"""ScoDoc 9 models : Référentiel Compétence BUT 2021 """ScoDoc 9 models : Référentiel Compétence BUT 2021
""" """
from datetime import datetime from datetime import datetime
from enum import unique
from typing import Any
from sqlalchemy.orm import class_mapper from sqlalchemy.orm import class_mapper
import sqlalchemy import sqlalchemy
@ -28,6 +26,8 @@ def attribute_names(cls):
class XMLModel: class XMLModel:
"""Mixin class, to ease loading Orebut XMLs"""
_xml_attribs = {} # to be overloaded _xml_attribs = {} # to be overloaded
id = "_" id = "_"
@ -162,6 +162,7 @@ class ApcCompetence(db.Model, XMLModel):
class ApcSituationPro(db.Model, XMLModel): class ApcSituationPro(db.Model, XMLModel):
"Situation professionnelle"
id = db.Column(db.Integer, primary_key=True) id = db.Column(db.Integer, primary_key=True)
competence_id = db.Column( competence_id = db.Column(
db.Integer, db.ForeignKey("apc_competence.id"), nullable=False db.Integer, db.ForeignKey("apc_competence.id"), nullable=False
@ -173,6 +174,7 @@ class ApcSituationPro(db.Model, XMLModel):
class ApcComposanteEssentielle(db.Model, XMLModel): class ApcComposanteEssentielle(db.Model, XMLModel):
"Composante essentielle"
id = db.Column(db.Integer, primary_key=True) id = db.Column(db.Integer, primary_key=True)
competence_id = db.Column( competence_id = db.Column(
db.Integer, db.ForeignKey("apc_competence.id"), nullable=False db.Integer, db.ForeignKey("apc_competence.id"), nullable=False
@ -199,6 +201,9 @@ class ApcNiveau(db.Model, XMLModel):
cascade="all, delete-orphan", cascade="all, delete-orphan",
) )
def __repr__(self):
return f"<{self.__class__.__name__} ordre={self.ordre}>"
def to_dict(self): def to_dict(self):
return { return {
"libelle": self.libelle, "libelle": self.libelle,
@ -222,14 +227,14 @@ class ApcAppCritique(db.Model, XMLModel):
backref=db.backref("app_critiques", lazy="dynamic"), backref=db.backref("app_critiques", lazy="dynamic"),
) )
def to_dict(self): def to_dict(self) -> dict:
return {"libelle": self.libelle} return {"libelle": self.libelle}
def get_label(self): def get_label(self) -> str:
return self.code + " - " + self.titre return self.code + " - " + self.titre
def __repr__(self): def __repr__(self):
return "<AppCritique {}>".format(self.code) return f"<{self.__class__.__name__} {self.code}>"
def get_saes(self): def get_saes(self):
"""Liste des SAE associées""" """Liste des SAE associées"""
@ -258,6 +263,9 @@ class ApcParcours(db.Model, XMLModel):
cascade="all, delete-orphan", cascade="all, delete-orphan",
) )
def __repr__(self):
return f"<{self.__class__.__name__} {self.code}>"
def to_dict(self): def to_dict(self):
return { return {
"code": self.code, "code": self.code,
@ -274,6 +282,9 @@ class ApcAnneeParcours(db.Model, XMLModel):
) )
ordre = db.Column(db.Integer) ordre = db.Column(db.Integer)
def __repr__(self):
return f"<{self.__class__.__name__} ordre={self.ordre}>"
def to_dict(self): def to_dict(self):
return { return {
"ordre": self.ordre, "ordre": self.ordre,
@ -320,3 +331,6 @@ class ApcParcoursNiveauCompetence(db.Model):
cascade="save-update, merge, delete, delete-orphan", cascade="save-update, merge, delete, delete-orphan",
), ),
) )
def __repr__(self):
return f"<{self.__class__.__name__} {self.competence} {self.annee_parcours}>"

View File

@ -13,14 +13,13 @@
<script src="/ScoDoc/static/js/ref_competences.js"></script> <script src="/ScoDoc/static/js/ref_competences.js"></script>
<div class="help"> <div class="help">
Référentiel chargé le {{ref.scodoc_date_loaded.strftime("%d/%m/%Y à %H:%M") if ref.scodoc_date_loaded else ""}} à partir du fichier <tt>{{ref.scodoc_orig_filename or "(inconnu)"}}</tt>. Référentiel chargé le {{ref.scodoc_date_loaded.strftime("%d/%m/%Y à %H:%M") if ref.scodoc_date_loaded else ""}} à
partir du fichier <tt>{{ref.scodoc_orig_filename or "(inconnu)"}}</tt>.
</div> </div>
<div class="part2"> <div class="part2">
<a class="stdlink" <a class="stdlink" href="{{url_for('notes.refcomp_table', scodoc_dept=g.scodoc_dept)}}">liste des référentiels</a>
href="{{url_for('notes.refcomp_table', scodoc_dept=g.scodoc_dept)}}"
>revenir à la liste des référentiels</a>
</div> </div>
{% endblock %} {% endblock %}

View File

@ -1,7 +1,7 @@
# -*- mode: python -*- # -*- mode: python -*-
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
SCOVERSION = "9.2.11" SCOVERSION = "9.2.12"
SCONAME = "ScoDoc" SCONAME = "ScoDoc"