API: modif /formsemestre/resultat: nombres ne chaines, respect JSON sans NaN
This commit is contained in:
parent
9bd2290076
commit
c3952c1118
@ -13,6 +13,7 @@ import app
|
|||||||
from app import models
|
from app import models
|
||||||
from app.api import bp
|
from app.api import bp
|
||||||
from app.api.auth import permission_required_api
|
from app.api.auth import permission_required_api
|
||||||
|
from app.api.errors import error_response
|
||||||
from app.comp import res_sem
|
from app.comp import res_sem
|
||||||
from app.comp.moy_mod import ModuleImplResults
|
from app.comp.moy_mod import ModuleImplResults
|
||||||
from app.comp.res_compat import NotesTableCompat
|
from app.comp.res_compat import NotesTableCompat
|
||||||
@ -336,7 +337,7 @@ def etat_evals(formsemestre_id: int):
|
|||||||
|
|
||||||
# Si il y a plus d'une note saisie pour l'évaluation
|
# Si il y a plus d'une note saisie pour l'évaluation
|
||||||
if len(notes) >= 1:
|
if len(notes) >= 1:
|
||||||
# Trie des notes en fonction de leurs dates
|
# Tri des notes en fonction de leurs dates
|
||||||
notes_sorted = sorted(notes, key=lambda note: note.date)
|
notes_sorted = sorted(notes, key=lambda note: note.date)
|
||||||
|
|
||||||
date_debut = notes_sorted[0].date
|
date_debut = notes_sorted[0].date
|
||||||
@ -369,11 +370,16 @@ def formsemestre_resultat(formsemestre_id: int):
|
|||||||
"""Tableau récapitulatif des résultats
|
"""Tableau récapitulatif des résultats
|
||||||
Pour chaque étudiant, son état, ses groupes, ses moyennes d'UE et de modules.
|
Pour chaque étudiant, son état, ses groupes, ses moyennes d'UE et de modules.
|
||||||
"""
|
"""
|
||||||
|
format_spec = request.args.get("format", None)
|
||||||
|
if format_spec is not None and format_spec != "raw":
|
||||||
|
return error_response(404, "invalid format specification")
|
||||||
|
convert_values = format_spec != "raw"
|
||||||
|
|
||||||
formsemestre = FormSemestre.query.get_or_404(formsemestre_id)
|
formsemestre = FormSemestre.query.get_or_404(formsemestre_id)
|
||||||
app.set_sco_dept(formsemestre.departement.acronym)
|
app.set_sco_dept(formsemestre.departement.acronym)
|
||||||
res: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre)
|
res: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre)
|
||||||
rows, footer_rows, titles, column_ids = res.get_table_recap(
|
rows, footer_rows, titles, column_ids = res.get_table_recap(
|
||||||
convert_values=False,
|
convert_values=convert_values,
|
||||||
include_evaluations=False,
|
include_evaluations=False,
|
||||||
mode_jury=False,
|
mode_jury=False,
|
||||||
allow_html=False,
|
allow_html=False,
|
||||||
|
@ -45,11 +45,12 @@ cli.register(app)
|
|||||||
|
|
||||||
@app.shell_context_processor
|
@app.shell_context_processor
|
||||||
def make_shell_context():
|
def make_shell_context():
|
||||||
from app.scodoc import notesdb as ndb
|
|
||||||
from app.scodoc import sco_utils as scu
|
|
||||||
import app as mapp # le package app
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
|
import app as mapp # le package app
|
||||||
|
from app.scodoc import notesdb as ndb
|
||||||
|
from app.comp import res_sem
|
||||||
|
from app.scodoc import sco_utils as scu
|
||||||
|
|
||||||
return {
|
return {
|
||||||
"ctx": app.test_request_context(),
|
"ctx": app.test_request_context(),
|
||||||
@ -77,6 +78,7 @@ def make_shell_context():
|
|||||||
"Permission": Permission,
|
"Permission": Permission,
|
||||||
"pp": pp,
|
"pp": pp,
|
||||||
"Role": Role,
|
"Role": Role,
|
||||||
|
"res_sem": res_sem,
|
||||||
"scolar": scolar,
|
"scolar": scolar,
|
||||||
"ScolarNews": models.ScolarNews,
|
"ScolarNews": models.ScolarNews,
|
||||||
"scu": scu,
|
"scu": scu,
|
||||||
|
Loading…
Reference in New Issue
Block a user