From 6d06242cbbc3cc4c44dbdb848c5b54fc96595209 Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Tue, 26 Apr 2022 06:02:17 +0200 Subject: [PATCH] comments --- app/models/but_refcomp.py | 24 +++++++++++++++++++----- app/templates/but/refcomp_show.html | 7 +++---- sco_version.py | 2 +- 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/app/models/but_refcomp.py b/app/models/but_refcomp.py index 429c63898..0750f1a9f 100644 --- a/app/models/but_refcomp.py +++ b/app/models/but_refcomp.py @@ -6,8 +6,6 @@ """ScoDoc 9 models : Référentiel Compétence BUT 2021 """ from datetime import datetime -from enum import unique -from typing import Any from sqlalchemy.orm import class_mapper import sqlalchemy @@ -28,6 +26,8 @@ def attribute_names(cls): class XMLModel: + """Mixin class, to ease loading Orebut XMLs""" + _xml_attribs = {} # to be overloaded id = "_" @@ -162,6 +162,7 @@ class ApcCompetence(db.Model, XMLModel): class ApcSituationPro(db.Model, XMLModel): + "Situation professionnelle" id = db.Column(db.Integer, primary_key=True) competence_id = db.Column( db.Integer, db.ForeignKey("apc_competence.id"), nullable=False @@ -173,6 +174,7 @@ class ApcSituationPro(db.Model, XMLModel): class ApcComposanteEssentielle(db.Model, XMLModel): + "Composante essentielle" id = db.Column(db.Integer, primary_key=True) competence_id = db.Column( db.Integer, db.ForeignKey("apc_competence.id"), nullable=False @@ -199,6 +201,9 @@ class ApcNiveau(db.Model, XMLModel): cascade="all, delete-orphan", ) + def __repr__(self): + return f"<{self.__class__.__name__} ordre={self.ordre}>" + def to_dict(self): return { "libelle": self.libelle, @@ -222,14 +227,14 @@ class ApcAppCritique(db.Model, XMLModel): backref=db.backref("app_critiques", lazy="dynamic"), ) - def to_dict(self): + def to_dict(self) -> dict: return {"libelle": self.libelle} - def get_label(self): + def get_label(self) -> str: return self.code + " - " + self.titre def __repr__(self): - return "".format(self.code) + return f"<{self.__class__.__name__} {self.code}>" def get_saes(self): """Liste des SAE associées""" @@ -258,6 +263,9 @@ class ApcParcours(db.Model, XMLModel): cascade="all, delete-orphan", ) + def __repr__(self): + return f"<{self.__class__.__name__} {self.code}>" + def to_dict(self): return { "code": self.code, @@ -274,6 +282,9 @@ class ApcAnneeParcours(db.Model, XMLModel): ) ordre = db.Column(db.Integer) + def __repr__(self): + return f"<{self.__class__.__name__} ordre={self.ordre}>" + def to_dict(self): return { "ordre": self.ordre, @@ -320,3 +331,6 @@ class ApcParcoursNiveauCompetence(db.Model): cascade="save-update, merge, delete, delete-orphan", ), ) + + def __repr__(self): + return f"<{self.__class__.__name__} {self.competence} {self.annee_parcours}>" diff --git a/app/templates/but/refcomp_show.html b/app/templates/but/refcomp_show.html index 2b245b59b..0e4ffef68 100644 --- a/app/templates/but/refcomp_show.html +++ b/app/templates/but/refcomp_show.html @@ -13,14 +13,13 @@
-Référentiel chargé le {{ref.scodoc_date_loaded.strftime("%d/%m/%Y à %H:%M") if ref.scodoc_date_loaded else ""}} à partir du fichier {{ref.scodoc_orig_filename or "(inconnu)"}}. + Référentiel chargé le {{ref.scodoc_date_loaded.strftime("%d/%m/%Y à %H:%M") if ref.scodoc_date_loaded else ""}} à + partir du fichier {{ref.scodoc_orig_filename or "(inconnu)"}}.
{% endblock %} diff --git a/sco_version.py b/sco_version.py index df7bcd01e..d5f9c8084 100644 --- a/sco_version.py +++ b/sco_version.py @@ -1,7 +1,7 @@ # -*- mode: python -*- # -*- coding: utf-8 -*- -SCOVERSION = "9.2.11" +SCOVERSION = "9.2.12" SCONAME = "ScoDoc"