From 9413384a048045767faf390a378c0e512861ad8d Mon Sep 17 00:00:00 2001 From: Emmanuel Viennet Date: Wed, 3 Aug 2022 16:05:01 +0200 Subject: [PATCH] /evaluation//notes --- app/api/evaluations.py | 19 ++++++++++--------- app/api/partitions.py | 2 +- app/but/jury_but_recap.py | 4 ++-- 3 files changed, 13 insertions(+), 12 deletions(-) diff --git a/app/api/evaluations.py b/app/api/evaluations.py index db3fe2fe7c..e804d6b9bd 100644 --- a/app/api/evaluations.py +++ b/app/api/evaluations.py @@ -17,8 +17,9 @@ from app.api import api_bp as bp, api_web_bp from app.decorators import scodoc, permission_required from app.api.errors import error_response from app.models import Evaluation, ModuleImpl, FormSemestre -from app.scodoc.sco_evaluation_db import do_evaluation_get_all_notes +from app.scodoc import sco_evaluation_db from app.scodoc.sco_permissions import Permission +import app.scodoc.sco_utils as scu @bp.route("/moduleimpl//evaluations") @@ -113,12 +114,12 @@ def evaluation_notes(evaluation_id: int): dept = evaluation.moduleimpl.formsemestre.departement app.set_sco_dept(dept.acronym) - try: - data = do_evaluation_get_all_notes(evaluation_id) - except AttributeError: # ??? - return error_response( - 404, - message="La requête ne peut être traitée en l’état actuel.", - ) + notes = sco_evaluation_db.do_evaluation_get_all_notes(evaluation_id) + for etudid in notes: + # "ABS", "EXC", etc mais laisse les notes sur le barème de l'éval. + note = notes[etudid] + note["value"] = scu.fmt_note(note["value"], keep_numeric=True) + note["note_max"] = evaluation.note_max + del note["id"] - return jsonify(data) + return jsonify(notes) diff --git a/app/api/partitions.py b/app/api/partitions.py index afdfca6e5d..f46598b260 100644 --- a/app/api/partitions.py +++ b/app/api/partitions.py @@ -12,7 +12,6 @@ from flask_login import login_required import app from app import db, log -from app import api from app.api import api_bp as bp, api_web_bp from app.decorators import scodoc, permission_required from app.api.errors import error_response @@ -25,6 +24,7 @@ from app.scodoc import sco_utils as scu @bp.route("/partition/") +@api_web_bp.route("/partition/") @login_required @scodoc @permission_required(Permission.ScoView) diff --git a/app/but/jury_but_recap.py b/app/but/jury_but_recap.py index 20d560e1eb..6611147e8e 100644 --- a/app/but/jury_but_recap.py +++ b/app/but/jury_but_recap.py @@ -484,12 +484,12 @@ def get_jury_but_etud_result( rcue_dict = { "ue_1": { "ue_id": rcue.ue_1.id, - "moy": dec_ue1.moy_ue, + "moy": None if np.isnan(dec_ue1.moy_ue) else dec_ue1.moy_ue, "code": dec_ue1.code_valide, }, "ue_2": { "ue_id": rcue.ue_2.id, - "moy": dec_ue2.moy_ue, + "moy": None if np.isnan(dec_ue2.moy_ue) else dec_ue2.moy_ue, "code": dec_ue2.code_valide, }, "moy": rcue.moy_rcue,