diff --git a/app/api/evaluations.py b/app/api/evaluations.py index cef58a426..7d7f9e1a6 100644 --- a/app/api/evaluations.py +++ b/app/api/evaluations.py @@ -7,6 +7,7 @@ from app import models from app.api import bp from app.api.auth import token_auth, token_permission_required from app.api.errors import error_response +from app.models import Evaluation from app.scodoc.sco_evaluation_db import do_evaluation_get_all_notes from app.scodoc.sco_permissions import Permission @@ -46,7 +47,7 @@ def evaluations(moduleimpl_id: int): ] """ # Récupération de toutes les évaluations - evals = models.Evaluation.query.filter_by(id=moduleimpl_id) + evals = Evaluation.query.filter_by(id=moduleimpl_id) # Mise en forme des données data = [d.to_dict() for d in evals] diff --git a/app/models/etudiants.py b/app/models/etudiants.py index 4c6672e21..2e9292c1d 100644 --- a/app/models/etudiants.py +++ b/app/models/etudiants.py @@ -171,7 +171,6 @@ class Identite(db.Model): """ from app.scodoc import sco_photos - dept = models.Departement.query.filter_by(id=self.dept_id).first_or_404() d = { "civilite": self.civilite, "code_ine": self.code_ine or "", @@ -180,7 +179,7 @@ class Identite(db.Model): if self.date_naissance else "", "dept_id": self.dept_id, - "dept_acronym": dept.acronym, + "dept_acronym": self.departement.acronym, "email": self.get_first_email() or "", "emailperso": self.get_first_email("emailperso"), "etudid": self.id, diff --git a/app/models/evaluations.py b/app/models/evaluations.py index 84383adc5..afe8e791a 100644 --- a/app/models/evaluations.py +++ b/app/models/evaluations.py @@ -54,7 +54,12 @@ class Evaluation(db.Model): # ScoDoc7 output_formators e["evaluation_id"] = self.id e["jour"] = ndb.DateISOtoDMY(e["jour"]) + e["date_debut"] = datetime.datetime.combine( + self.jour, self.heure_debut + ).isoformat() + e["date_fin"] = datetime.datetime.combine(self.jour, self.heure_fin).isoformat() e["numero"] = ndb.int_null_is_zero(e["numero"]) + e["poids"] = self.get_ue_poids_dict() # { ue_id : poids } return evaluation_enrich_dict(e) def from_dict(self, data): @@ -153,7 +158,7 @@ class EvaluationUEPoids(db.Model): # Fonction héritée de ScoDoc7 à refactorer def evaluation_enrich_dict(e): - """add or convert some fileds in an evaluation dict""" + """add or convert some fields in an evaluation dict""" # For ScoDoc7 compat heure_debut_dt = e["heure_debut"] or datetime.time( 8, 00