forked from ScoDoc/ScoDoc
prise en compte des remarques d'evaluations.py
This commit is contained in:
parent
be3df71ad6
commit
2cf1e162df
@ -1,6 +1,8 @@
|
||||
############################################### Evaluations ###########################################################
|
||||
from flask import jsonify
|
||||
|
||||
import app
|
||||
|
||||
from app import models
|
||||
from app.api import bp
|
||||
from app.api.auth import token_permission_required
|
||||
@ -16,15 +18,39 @@ def evaluations(moduleimpl_id: int):
|
||||
Retourne la liste des évaluations à partir de l'id d'un moduleimpl
|
||||
|
||||
moduleimpl_id : l'id d'un moduleimpl
|
||||
|
||||
Exemple de résultat :
|
||||
[
|
||||
{
|
||||
"jour": "20/04/2022",
|
||||
"id": 1,
|
||||
"heure_fin": "09h00",
|
||||
"note_max": 20.0,
|
||||
"visibulletin": true,
|
||||
"evaluation_type": 0,
|
||||
"moduleimpl_id": 1,
|
||||
"heure_debut": "08h00",
|
||||
"description": "eval1",
|
||||
"coefficient": 1.0,
|
||||
"publish_incomplete": false,
|
||||
"numero": 0,
|
||||
"evaluation_id": 1,
|
||||
"jouriso": "2022-04-20",
|
||||
"duree": "1h",
|
||||
"descrheure": " de 08h00 \u00e0 09h00",
|
||||
"matin": 1,
|
||||
"apresmidi": 0
|
||||
},
|
||||
...
|
||||
]
|
||||
"""
|
||||
# Récupération de toutes les évaluations
|
||||
evals = models.Evaluation.query.filter_by(id=moduleimpl_id).all()
|
||||
evals = models.Evaluation.query.filter_by(id=moduleimpl_id)
|
||||
|
||||
# Mise en forme des données
|
||||
data = [d.to_dict() for d in evals]
|
||||
|
||||
return jsonify(data)
|
||||
# return error_response(501, message="Not implemented")
|
||||
|
||||
|
||||
@bp.route("/evaluations/eval_notes/<int:evaluation_id>", methods=["GET"])
|
||||
@ -34,9 +60,44 @@ def evaluation_notes(evaluation_id: int):
|
||||
Retourne la liste des notes à partir de l'id d'une évaluation donnée
|
||||
|
||||
evaluation_id : l'id d'une évaluation
|
||||
|
||||
Exemple de résultat :
|
||||
{
|
||||
"1": {
|
||||
"id": 1,
|
||||
"etudid": 10,
|
||||
"evaluation_id": 1,
|
||||
"value": 15.0,
|
||||
"comment": "",
|
||||
"date": "Wed, 20 Apr 2022 06:49:05 GMT",
|
||||
"uid": 2
|
||||
},
|
||||
"2": {
|
||||
"id": 2,
|
||||
"etudid": 1,
|
||||
"evaluation_id": 1,
|
||||
"value": 12.0,
|
||||
"comment": "",
|
||||
"date": "Wed, 20 Apr 2022 06:49:06 GMT",
|
||||
"uid": 2
|
||||
},
|
||||
...
|
||||
}
|
||||
"""
|
||||
# Fonction utilisée : app.scodoc.sco_evaluation_db.do_evaluation_get_all_notes()
|
||||
|
||||
eval = models.Evaluation.query.filter_by(id=evaluation_id).first_or_404()
|
||||
|
||||
moduleimpl = models.ModuleImpl.query.filter_by(id=eval.moduleimpl_id).first_or_404()
|
||||
|
||||
formsemestre = models.FormSemestre.query.filter_by(
|
||||
id=moduleimpl.formsemestre_id
|
||||
).first_or_404()
|
||||
|
||||
dept = models.Departement.query.filter_by(id=formsemestre.dept_id).first_or_404()
|
||||
|
||||
app.set_sco_dept(dept.acronym)
|
||||
|
||||
try:
|
||||
# Utilisation de la fonction do_evaluation_get_all_notes
|
||||
data = do_evaluation_get_all_notes(evaluation_id)
|
||||
@ -48,35 +109,3 @@ def evaluation_notes(evaluation_id: int):
|
||||
)
|
||||
|
||||
return jsonify(data)
|
||||
|
||||
|
||||
@bp.route(
|
||||
"/evaluations/eval_set_notes?eval_id=<int:eval_id>&etudid=<int:etudid>¬e=<float:note>",
|
||||
methods=["POST"],
|
||||
)
|
||||
@bp.route(
|
||||
"/evaluations/eval_set_notes?eval_id=<int:eval_id>&nip=<int:nip>¬e=<float:note>",
|
||||
methods=["POST"],
|
||||
)
|
||||
@bp.route(
|
||||
"/evaluations/eval_set_notes?eval_id=<int:eval_id>&ine=<int:ine>¬e=<float:note>",
|
||||
methods=["POST"],
|
||||
)
|
||||
@token_permission_required(Permission.APIEditAllNotes)
|
||||
def evaluation_set_notes(
|
||||
eval_id: int, note: float, etudid: int = None, nip: int = None, ine: int = None
|
||||
):
|
||||
"""
|
||||
Set les notes d'une évaluation pour un étudiant donnée
|
||||
|
||||
eval_id : l'id d'une évaluation
|
||||
note : la note à attribuer
|
||||
etudid : l'etudid d'un étudiant
|
||||
nip : le code nip d'un étudiant
|
||||
ine : le code ine d'un étudiant
|
||||
"""
|
||||
# Fonction utilisée : app.scodoc.sco_saisie_notes.notes_add()
|
||||
|
||||
# Qu'est ce qu'un user ???
|
||||
# notes_add()
|
||||
return error_response(501, message="Not implemented")
|
||||
|
Loading…
Reference in New Issue
Block a user