correction sco_abs.py + petites modifications sur différents fichiers api

This commit is contained in:
leonard_montalbano 2022-04-27 15:29:09 +02:00
parent 1c87405f42
commit f0ce0b574e
7 changed files with 118 additions and 116 deletions

View File

@ -70,7 +70,7 @@ def absences(etudid: int = None, nip: int = None, ine: int = None):
@bp.route("/absences/nip/<int:nip>/just", methods=["GET"])
@bp.route("/absences/ine/<int:ine>/just", methods=["GET"])
@token_permission_required(Permission.APIView)
def absences_justify(etudid: int = None, nip: int = None, ine: int = None):
def absences_just(etudid: int = None, nip: int = None, ine: int = None):
"""
Retourne la liste des absences justifiées d'un étudiant donné

View File

@ -40,6 +40,7 @@ def liste_etudiants(dept: str, formsemestre_id=None):
formsemestre_id: l'id d'un formesemestre
Exemple de résultat :
[
{
"civilite": "X",
"code_ine": null,
@ -63,6 +64,7 @@ def liste_etudiants(dept: str, formsemestre_id=None):
"prenom": "ANNE"
},
...
]
"""
# Si le formsemestre_id a été renseigné
if formsemestre_id is not None:
@ -248,7 +250,6 @@ def semestre_index(dept: str, formsemestre_id: int):
...
]
}
"""
app.set_sco_dept(dept)

View File

@ -13,7 +13,7 @@ from app.scodoc.sco_permissions import Permission
from app.scodoc.sco_pvjury import formsemestre_pvjury
@bp.route("/formations/formsemestre/<int:formsemestre_id>", methods=["GET"])
@bp.route("/formsemestre/<int:formsemestre_id>", methods=["GET"])
@token_permission_required(Permission.APIView)
def formsemestre(formsemestre_id: int):
"""

View File

@ -10,7 +10,7 @@ from app.scodoc.sco_pvjury import formsemestre_pvjury
@bp.route("/jury/formsemestre/<int:formsemestre_id>/preparation_jury", methods=["GET"])
# @token_permission_required(Permission.)
# @token_permission_required(Permission.?)
def jury_preparation(formsemestre_id: int):
"""
Retourne la feuille de préparation du jury
@ -26,7 +26,7 @@ def jury_preparation(formsemestre_id: int):
@bp.route("/jury/formsemestre/<int:formsemestre_id>/decisions_jury", methods=["GET"])
# @token_permission_required(Permission.)
# @token_permission_required(Permission.?)
def jury_decisions(formsemestre_id: int):
"""
Retourne les décisions du jury suivant un formsemestre donné
@ -39,69 +39,3 @@ def jury_decisions(formsemestre_id: int):
decision_jury = formsemestre_pvjury(formsemestre_id)
return error_response(501, message="Not implemented")
@bp.route(
"/jury/set_decision/etudid?etudid=<int:etudid>&formsemestre_id=<int:formesemestre_id>"
"&jury=<string:decision_jury>&devenir=<string:devenir_jury>&assiduite=<bool>",
methods=["POST"],
)
@bp.route(
"/jury/set_decision/nip?etudid=<int:etudid>&formsemestre_id=<int:formesemestre_id>"
"&jury=<string:decision_jury>&devenir=<string:devenir_jury>&assiduite=<bool>",
methods=["POST"],
)
@bp.route(
"/jury/set_decision/ine?etudid=<int:etudid>&formsemestre_id=<int:formesemestre_id>"
"&jury=<string:decision_jury>&devenir=<string:devenir_jury>&assiduite=<bool>",
methods=["POST"],
)
# @token_permission_required(Permission.)
def set_decision_jury(
formsemestre_id: int,
decision_jury: str,
devenir_jury: str,
assiduite: bool,
etudid: int = None,
nip: int = None,
ine: int = None,
):
"""
Attribuer la décision du jury et le devenir à un etudiant
formsemestre_id : l'id d'un formsemestre
decision_jury : la décision du jury
devenir_jury : le devenir du jury
assiduite : True ou False
etudid : l'etudid d'un étudiant
nip: le code nip d'un étudiant
ine : le code ine d'un étudiant
"""
return error_response(501, message="Not implemented")
@bp.route(
"/jury/etudid/<int:etudid>/formsemestre/<int:formsemestre_id>/annule_decision",
methods=["DELETE"],
)
@bp.route(
"/jury/nip/<int:nip>/formsemestre/<int:formsemestre_id>/annule_decision",
methods=["DELETE"],
)
@bp.route(
"/jury/ine/<int:ine>/formsemestre/<int:formsemestre_id>/annule_decision",
methods=["DELETE"],
)
# @token_permission_required(Permission.)
def annule_decision_jury(
formsemestre_id: int, etudid: int = None, nip: int = None, ine: int = None
):
"""
Supprime la déciosion du jury pour un étudiant donné
formsemestre_id : l'id d'un formsemestre
etudid : l'etudid d'un étudiant
nip: le code nip d'un étudiant
ine : le code ine d'un étudiant
"""
return error_response(501, message="Not implemented")

View File

@ -186,3 +186,68 @@
# )
# return error_response(200, message="OK")
# @bp.route(
# "/jury/set_decision/etudid?etudid=<int:etudid>&formsemestre_id=<int:formesemestre_id>"
# "&jury=<string:decision_jury>&devenir=<string:devenir_jury>&assiduite=<bool>",
# methods=["POST"],
# )
# @bp.route(
# "/jury/set_decision/nip?etudid=<int:etudid>&formsemestre_id=<int:formesemestre_id>"
# "&jury=<string:decision_jury>&devenir=<string:devenir_jury>&assiduite=<bool>",
# methods=["POST"],
# )
# @bp.route(
# "/jury/set_decision/ine?etudid=<int:etudid>&formsemestre_id=<int:formesemestre_id>"
# "&jury=<string:decision_jury>&devenir=<string:devenir_jury>&assiduite=<bool>",
# methods=["POST"],
# )
# # @token_permission_required(Permission.)
# def set_decision_jury(
# formsemestre_id: int,
# decision_jury: str,
# devenir_jury: str,
# assiduite: bool,
# etudid: int = None,
# nip: int = None,
# ine: int = None,
# ):
# """
# Attribuer la décision du jury et le devenir à un etudiant
#
# formsemestre_id : l'id d'un formsemestre
# decision_jury : la décision du jury
# devenir_jury : le devenir du jury
# assiduite : True ou False
# etudid : l'etudid d'un étudiant
# nip: le code nip d'un étudiant
# ine : le code ine d'un étudiant
# """
# return error_response(501, message="Not implemented")
#
#
# @bp.route(
# "/jury/etudid/<int:etudid>/formsemestre/<int:formsemestre_id>/annule_decision",
# methods=["DELETE"],
# )
# @bp.route(
# "/jury/nip/<int:nip>/formsemestre/<int:formsemestre_id>/annule_decision",
# methods=["DELETE"],
# )
# @bp.route(
# "/jury/ine/<int:ine>/formsemestre/<int:formsemestre_id>/annule_decision",
# methods=["DELETE"],
# )
# # @token_permission_required(Permission.)
# def annule_decision_jury(
# formsemestre_id: int, etudid: int = None, nip: int = None, ine: int = None
# ):
# """
# Supprime la déciosion du jury pour un étudiant donné
#
# formsemestre_id : l'id d'un formsemestre
# etudid : l'etudid d'un étudiant
# nip: le code nip d'un étudiant
# ine : le code ine d'un étudiant
# """
# return error_response(501, message="Not implemented")

View File

@ -420,13 +420,15 @@ WHERE A.ETUDID = %(etudid)s
def list_abs_date(etudid, beg_date=None, end_date=None):
"""Liste des absences et justifs entre deux dates (inclues)."""
print("On rentre")
cnx = ndb.GetDBConnexion()
cursor = cnx.cursor(cursor_factory=ndb.ScoDocCursor)
print("Juste avant le SQL")
cursor.execute(
"""SELECT jour, matin, estabs, estjust, description FROM ABSENCES A
WHERE A.ETUDID = %(etudid)s"""
+ (
""
+ ""
if beg_date is None
else """
AND A.jour >= %(beg_date)s
@ -434,7 +436,7 @@ def list_abs_date(etudid, beg_date=None, end_date=None):
""",
vars(),
)
)
absences = cursor.dictfetchall()
# remove duplicates
A = {} # { (jour, matin) : abs }

View File

@ -24,7 +24,7 @@ from tests.api.setup_test_api import SCODOC_URL, CHECK_CERTIFICATE, HEADERS
# formsemestre
def test_formsemestre():
r = requests.get(
SCODOC_URL + "/ScoDoc/api/formations/formsemestre/1",
SCODOC_URL + "/ScoDoc/api/formsemestre/1",
headers=HEADERS,
verify=CHECK_CERTIFICATE,
)