forked from ScoDoc/ScoDoc
soucis avec routes logos
This commit is contained in:
parent
ba164481a6
commit
d468a3f49e
@ -50,13 +50,14 @@ from app.api.errors import error_response
|
|||||||
from app import models
|
from app import models
|
||||||
from app.models import FormSemestre, FormSemestreInscription, Identite
|
from app.models import FormSemestre, FormSemestreInscription, Identite
|
||||||
from app.models import ApcReferentielCompetences
|
from app.models import ApcReferentielCompetences
|
||||||
from app.scodoc.sco_abs import annule_absence, annule_justif, add_absence, add_justif
|
from app.scodoc.sco_abs import annule_absence, annule_justif, add_absence, add_justif, list_abs_date
|
||||||
from app.scodoc.sco_bulletins import formsemestre_bulletinetud_dict
|
from app.scodoc.sco_bulletins import formsemestre_bulletinetud_dict
|
||||||
from app.scodoc.sco_bulletins_json import make_json_formsemestre_bulletinetud
|
from app.scodoc.sco_bulletins_json import make_json_formsemestre_bulletinetud
|
||||||
from app.scodoc.sco_evaluation_db import do_evaluation_get_all_notes
|
from app.scodoc.sco_evaluation_db import do_evaluation_get_all_notes
|
||||||
from app.scodoc.sco_formations import formation_export
|
from app.scodoc.sco_formations import formation_export
|
||||||
from app.scodoc.sco_formsemestre_inscriptions import do_formsemestre_inscription_listinscrits
|
from app.scodoc.sco_formsemestre_inscriptions import do_formsemestre_inscription_listinscrits
|
||||||
from app.scodoc.sco_groups import setGroups, get_etud_groups, get_group_members
|
from app.scodoc.sco_groups import setGroups, get_etud_groups, get_group_members
|
||||||
|
from app.scodoc.sco_logos import list_logos, find_logo, _list_dept_logos
|
||||||
from app.scodoc.sco_moduleimpl import moduleimpl_list
|
from app.scodoc.sco_moduleimpl import moduleimpl_list
|
||||||
from app.scodoc.sco_permissions import Permission
|
from app.scodoc.sco_permissions import Permission
|
||||||
|
|
||||||
@ -686,9 +687,9 @@ def absences_justify(etudid=None, nip=None, ine=None):
|
|||||||
return error_response(501, message="Not implemented")
|
return error_response(501, message="Not implemented")
|
||||||
|
|
||||||
|
|
||||||
@bp.route("/absences/abs_signale?etudid=<int:etudid>&date=<string:date>&matin=<string:matin>&justif=<string:justif>",
|
@bp.route("/absences/abs_signale?etudid=<int:etudid>&date=<string:date>&matin=<string:matin>&justif=<string:justif>"
|
||||||
"&description=<string:description>", methods=["POST"])
|
"&description=<string:description>", methods=["POST"])
|
||||||
@bp.route("/absences/abs_signale?nip=<int:nip>&date=<string:date>&matin=<string:matin>&justif=<string:justif>",
|
@bp.route("/absences/abs_signale?nip=<int:nip>&date=<string:date>&matin=<string:matin>&justif=<string:justif>"
|
||||||
"&description=<string:description>", methods=["POST"])
|
"&description=<string:description>", methods=["POST"])
|
||||||
@bp.route("/absences/abs_signale?ine=<int:ine>&date=<string:date>&matin=<string:matin>&justif=<string:justif>"
|
@bp.route("/absences/abs_signale?ine=<int:ine>&date=<string:date>&matin=<string:matin>&justif=<string:justif>"
|
||||||
"&description=<string:description>", methods=["POST"])
|
"&description=<string:description>", methods=["POST"])
|
||||||
@ -820,17 +821,25 @@ def abs_annule_justif(jour: datetime, matin: str, etudid=None, nip=None, ine=Non
|
|||||||
|
|
||||||
|
|
||||||
@bp.route(
|
@bp.route(
|
||||||
"/absences/abs_group_etat/?group_ids=<int:group_ids>&date_debut=date_debut&date_fin=date_fin",
|
"/absences/abs_group_etat/?group_id=<int:group_id>&date_debut=date_debut&date_fin=date_fin",
|
||||||
methods=["GET"],
|
methods=["GET"],
|
||||||
)
|
)
|
||||||
def abs_groupe_etat(
|
def abs_groupe_etat(
|
||||||
group_ids: int, date_debut, date_fin, with_boursier=True, format="html"
|
group_id: int, date_debut, date_fin, with_boursier=True, format="html"
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
Liste des absences d'un ou plusieurs groupes entre deux dates
|
Liste des absences d'un ou plusieurs groupes entre deux dates
|
||||||
"""
|
"""
|
||||||
|
try:
|
||||||
|
members = get_group_members(group_id)
|
||||||
|
except ValueError:
|
||||||
|
return error_response(409, message="La requête ne peut être traitée en l’état actuel")
|
||||||
|
data = []
|
||||||
|
for member in members:
|
||||||
|
abs = list_abs_date(member.id, date_debut, date_fin)
|
||||||
|
data.append(abs)
|
||||||
|
|
||||||
# list_abs_date
|
# return jsonify(data) # XXX TODO faire en sorte de pouvoir renvoyer sa (ex to_dict() dans absences)
|
||||||
return error_response(501, message="Not implemented")
|
return error_response(501, message="Not implemented")
|
||||||
|
|
||||||
|
|
||||||
@ -843,16 +852,32 @@ def liste_logos(format="json"):
|
|||||||
Liste des logos définis pour le site scodoc.
|
Liste des logos définis pour le site scodoc.
|
||||||
"""
|
"""
|
||||||
# fonction to use : list_logos()
|
# fonction to use : list_logos()
|
||||||
return error_response(501, message="Not implemented")
|
try:
|
||||||
|
res = list_logos()
|
||||||
|
except ValueError:
|
||||||
|
return error_response(409, message="La requête ne peut être traitée en l’état actuel")
|
||||||
|
|
||||||
|
if res is None:
|
||||||
|
return error_response(200, message="Aucun logo trouvé correspondant aux informations renseignés")
|
||||||
|
|
||||||
|
return res
|
||||||
|
|
||||||
|
|
||||||
@bp.route("/logos/<string:nom>", methods=["GET"])
|
@bp.route("/logos/<string:logo_name>", methods=["GET"])
|
||||||
def recup_logo_global(nom: str):
|
def recup_logo_global(logo_name: str):
|
||||||
"""
|
"""
|
||||||
Retourne l'image au format png ou jpg
|
Retourne l'image au format png ou jpg
|
||||||
"""
|
"""
|
||||||
# fonction to use find_logo
|
# fonction to use find_logo
|
||||||
return error_response(501, message="Not implemented")
|
try:
|
||||||
|
res = find_logo(logo_name)
|
||||||
|
except ValueError:
|
||||||
|
return error_response(409, message="La requête ne peut être traitée en l’état actuel")
|
||||||
|
|
||||||
|
if res is None:
|
||||||
|
return error_response(200, message="Aucun logo trouvé correspondant aux informations renseignés")
|
||||||
|
|
||||||
|
return res
|
||||||
|
|
||||||
|
|
||||||
@bp.route("/departements/<string:dept>/logos", methods=["GET"])
|
@bp.route("/departements/<string:dept>/logos", methods=["GET"])
|
||||||
@ -860,13 +885,32 @@ def logo_dept(dept: str):
|
|||||||
"""
|
"""
|
||||||
Liste des logos définis pour le département visé.
|
Liste des logos définis pour le département visé.
|
||||||
"""
|
"""
|
||||||
return error_response(501, message="Not implemented")
|
# fonction to use: _list_dept_logos
|
||||||
|
dept_id = models.Departement.query.filter_by(acronym=dept).first()
|
||||||
|
try:
|
||||||
|
res = _list_dept_logos(dept_id.id)
|
||||||
|
except ValueError:
|
||||||
|
return error_response(409, message="La requête ne peut être traitée en l’état actuel")
|
||||||
|
|
||||||
|
if res is None:
|
||||||
|
return error_response(200, message="Aucun logo trouvé correspondant aux informations renseignés")
|
||||||
|
|
||||||
|
return res
|
||||||
|
|
||||||
|
|
||||||
@bp.route("/departement/<string:dept>/logos/<string:nom>", methods=["GET"])
|
@bp.route("/departement/<string:dept>/logos/<string:logo_name>", methods=["GET"])
|
||||||
def recup_logo_dept_global(dept: str, nom: str):
|
def recup_logo_dept_global(dept: str, logo_name: str):
|
||||||
"""
|
"""
|
||||||
L'image format png ou jpg
|
L'image format png ou jpg
|
||||||
"""
|
"""
|
||||||
# fonction to use find_logo
|
# fonction to use find_logo
|
||||||
return error_response(501, message="Not implemented")
|
dept_id = models.Departement.query.filter_by(acronym=dept).first()
|
||||||
|
try:
|
||||||
|
res = find_logo(logo_name, dept_id.id)
|
||||||
|
except ValueError:
|
||||||
|
return error_response(409, message="La requête ne peut être traitée en l’état actuel")
|
||||||
|
|
||||||
|
if res is None:
|
||||||
|
return error_response(200, message="Aucun logo trouvé correspondant aux informations renseignés")
|
||||||
|
|
||||||
|
return res
|
||||||
|
Loading…
Reference in New Issue
Block a user