1
0
forked from ScoDoc/ScoDoc

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,7 +40,8 @@ def liste_etudiants(dept: str, formsemestre_id=None):
formsemestre_id: l'id d'un formesemestre
Exemple de résultat :
{
[
{
"civilite": "X",
"code_ine": null,
"code_nip": null,
@ -50,8 +51,8 @@ def liste_etudiants(dept: str, formsemestre_id=None):
"etudid": 18,
"nom": "MOREL",
"prenom": "JACQUES"
},
{
},
{
"civilite": "X",
"code_ine": null,
"code_nip": null,
@ -61,8 +62,9 @@ def liste_etudiants(dept: str, formsemestre_id=None):
"etudid": 19,
"nom": "FOURNIER",
"prenom": "ANNE"
},
...
},
...
]
"""
# Si le formsemestre_id a été renseigné
if formsemestre_id is not None:
@ -96,39 +98,39 @@ def liste_semestres_courant(dept: str):
dept: l'acronym d'un département
Exemple de résultat :
[
{
"titre": "master machine info",
"gestion_semestrielle": false,
"scodoc7_id": null,
"date_debut": "01/09/2021",
"bul_bgcolor": null,
"date_fin": "15/12/2022",
"resp_can_edit": false,
"dept_id": 1,
"etat": true,
"resp_can_change_ens": false,
"id": 1,
"modalite": "FI",
"ens_can_edit_eval": false,
"formation_id": 1,
"gestion_compensation": false,
"elt_sem_apo": null,
"semestre_id": 1,
"bul_hide_xml": false,
"elt_annee_apo": null,
"block_moyennes": false,
"formsemestre_id": 1,
"titre_num": "master machine info semestre 1",
"date_debut_iso": "2021-09-01",
"date_fin_iso": "2022-12-15",
"responsables": [
3,
2
]
},
...
]
[
{
"titre": "master machine info",
"gestion_semestrielle": false,
"scodoc7_id": null,
"date_debut": "01/09/2021",
"bul_bgcolor": null,
"date_fin": "15/12/2022",
"resp_can_edit": false,
"dept_id": 1,
"etat": true,
"resp_can_change_ens": false,
"id": 1,
"modalite": "FI",
"ens_can_edit_eval": false,
"formation_id": 1,
"gestion_compensation": false,
"elt_sem_apo": null,
"semestre_id": 1,
"bul_hide_xml": false,
"elt_annee_apo": null,
"block_moyennes": false,
"formsemestre_id": 1,
"titre_num": "master machine info semestre 1",
"date_debut_iso": "2021-09-01",
"date_fin_iso": "2022-12-15",
"responsables": [
3,
2
]
},
...
]
"""
# Récupération des départements comportant l'acronym mit en paramètre
dept = models.Departement.query.filter_by(acronym=dept).first_or_404()
@ -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,21 +420,23 @@ 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 """
+ ""
if beg_date is None
else """
AND A.jour >= %(beg_date)s
AND A.jour <= %(end_date)s
""",
vars(),
)
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,
)