1
0
forked from ScoDoc/ScoDoc

ajout des dates au format iso

This commit is contained in:
leonard_montalbano 2022-06-09 15:43:19 +02:00
parent 25422b7f81
commit d245030b65

View File

@ -7,15 +7,11 @@ import app
from app import models
from app.api import bp
from app.api.auth import token_auth, token_permission_required
from app.api.tools import calculate_median
from app.comp import res_sem
from app.comp.moy_mod import ModuleImplResults
from app.comp.res_compat import NotesTableCompat
from app.models import Departement, FormSemestre, FormSemestreEtape, Module, ModuleImpl
from app.scodoc import sco_evaluation_db
from app.models import Departement, FormSemestre, FormSemestreEtape, ModuleImpl
from app.scodoc.sco_bulletins import get_formsemestre_bulletin_etud_json
from app.scodoc.sco_evaluation_recap import evaluations_recap_table
from app.scodoc.sco_evaluations import do_evaluation_etat_in_sem, do_evaluation_etat
from app.scodoc.sco_groups import get_etud_groups
from app.scodoc.sco_permissions import Permission
from app.scodoc.sco_utils import ModuleType
@ -494,6 +490,7 @@ def etat_evals(formsemestre_id: int):
"description": null,
"datetime_epreuve": null,
"heure_fin": "09:00:00",
"coefficient": "02.00"
"comptee": "oui",
"inscrits": 16,
"manquantes": 0,
@ -501,9 +498,9 @@ def etat_evals(formsemestre_id: int):
"ATT": 0,
"EXC": 0,
"saisie_notes": {
"datetime_debut": "Wed, 01 Jun 2022 10:37:59 GMT",
"datetime_fin": "Wed, 01 Jun 2022 13:18:09 GMT",
"datetime_mediane": "Wed, 01 Jun 2022 12:38:57 GMT"
"datetime_debut": "2021-09-11T00:00:00+02:00",
"datetime_fin": "2022-08-25T00:00:00+02:00",
"datetime_mediane": "2022-03-19T00:00:00+01:00"
}
},
{
@ -518,9 +515,9 @@ def etat_evals(formsemestre_id: int):
"ATT": 0,
"EXC": 0,
"saisie_notes": {
"datetime_debut": "Wed, 01 Jun 2022 12:04:19 GMT",
"datetime_fin": "Wed, 01 Jun 2022 12:04:36 GMT",
"datetime_mediane": "Wed, 01 Jun 2022 14:04:27 GMT"
"datetime_debut": "2021-09-11T00:00:00+02:00",
"datetime_fin": "2022-08-25T00:00:00+02:00",
"datetime_mediane": "2022-03-19T00:00:00+01:00"
}
},
]
@ -562,8 +559,11 @@ def etat_evals(formsemestre_id: int):
eval["id"] = evaluation.id
eval["description"] = evaluation.description
eval["datetime_epreuve"] = evaluation.jour
eval["datetime_epreuve"] = (
evaluation.jour.isoformat() if evaluation.jour is not None else None
)
eval["heure_fin"] = evaluation.heure_fin.isoformat()
eval["coefficient"] = evaluation.coefficient
eval["comptee"] = "oui" if eval_etat.is_complete else "non"
eval["inscrits"] = modimpl_results.nb_inscrits_module
eval["manquantes"] = len(
@ -582,6 +582,10 @@ def etat_evals(formsemestre_id: int):
evaluation_id=evaluation.id
).all()
date_debut = None
date_fin = None
date_mediane = None
# Si il y a plus d'une note saisie pour l'évaluation
if len(notes) >= 1:
# Trie des notes en fonction de leurs dates
@ -598,19 +602,20 @@ def etat_evals(formsemestre_id: int):
int((len(list_id_notes_sorted)) / 2)
]
date_mediane = ""
for n in notes_sorted:
if n.id == id_mediane:
date_mediane = n.date
else:
date_debut = None
date_fin = None
date_mediane = None
eval["saisie_notes"] = {
"datetime_debut": date_debut,
"datetime_fin": date_fin,
"datetime_mediane": date_mediane,
"datetime_debut": date_debut.isoformat()
if date_debut is not None
else None,
"datetime_fin": date_fin.isoformat()
if date_fin is not None
else None,
"datetime_mediane": date_mediane.isoformat()
if date_mediane is not None
else None,
}
list_eval.append(eval)