Compare commits

...

8 Commits

8 changed files with 86 additions and 25 deletions

View File

@ -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

View File

@ -518,11 +518,15 @@ class NotesTableCompat(ResultatsSemestre):
return "" return ""
return ins.etat return ins.etat
def get_etud_mat_moy(self, matiere_id, etudid): def get_etud_mat_moy(self, matiere_id: int, etudid: int) -> str:
"""moyenne d'un étudiant dans une matière (ou NA si pas de notes)""" """moyenne d'un étudiant dans une matière (ou NA si pas de notes)"""
if not self.moyennes_matieres: if not self.moyennes_matieres:
return "nd" return "nd"
return self.moyennes_matieres[matiere_id][etudid] return (
self.moyennes_matieres[matiere_id].get(etudid, "-")
if matiere_id in self.moyennes_matieres
else "-"
)
def get_etud_mod_moy(self, moduleimpl_id: int, etudid: int) -> float: def get_etud_mod_moy(self, moduleimpl_id: int, etudid: int) -> float:
"""La moyenne de l'étudiant dans le moduleimpl """La moyenne de l'étudiant dans le moduleimpl

View File

@ -284,7 +284,7 @@ class BulletinGeneratorStandard(sco_bulletins_generator.BulletinGenerator):
) )
with_col_moypromo = prefs["bul_show_moypromo"] with_col_moypromo = prefs["bul_show_moypromo"]
with_col_rang = prefs["bul_show_rangs"] with_col_rang = prefs["bul_show_rangs"]
with_col_coef = prefs["bul_show_coef"] with_col_coef = prefs["bul_show_coef"] or prefs["bul_show_ue_coef"]
with_col_ects = prefs["bul_show_ects"] with_col_ects = prefs["bul_show_ects"]
colkeys = ["titre", "module"] # noms des colonnes à afficher colkeys = ["titre", "module"] # noms des colonnes à afficher
@ -409,7 +409,7 @@ class BulletinGeneratorStandard(sco_bulletins_generator.BulletinGenerator):
# Chaque UE: # Chaque UE:
for ue in I["ues"]: for ue in I["ues"]:
ue_type = None ue_type = None
coef_ue = ue["coef_ue_txt"] coef_ue = ue["coef_ue_txt"] if prefs["bul_show_ue_coef"] else ""
ue_descr = ue["ue_descr_txt"] ue_descr = ue["ue_descr_txt"]
rowstyle = "" rowstyle = ""
plusminus = minuslink # plusminus = minuslink #
@ -592,7 +592,7 @@ class BulletinGeneratorStandard(sco_bulletins_generator.BulletinGenerator):
"_titre_colspan": 2, "_titre_colspan": 2,
"rang": mod["mod_rang_txt"], # vide si pas option rang "rang": mod["mod_rang_txt"], # vide si pas option rang
"note": mod["mod_moy_txt"], "note": mod["mod_moy_txt"],
"coef": mod["mod_coef_txt"], "coef": mod["mod_coef_txt"] if prefs["bul_show_coef"] else "",
"abs": mod.get( "abs": mod.get(
"mod_abs_txt", "" "mod_abs_txt", ""
), # absent si pas option show abs module ), # absent si pas option show abs module
@ -656,7 +656,9 @@ class BulletinGeneratorStandard(sco_bulletins_generator.BulletinGenerator):
eval_style = "" eval_style = ""
t = { t = {
"module": '<bullet indent="2mm">&bull;</bullet>&nbsp;' + e["name"], "module": '<bullet indent="2mm">&bull;</bullet>&nbsp;' + e["name"],
"coef": "<i>" + e["coef_txt"] + "</i>", "coef": ("<i>" + e["coef_txt"] + "</i>")
if prefs["bul_show_coef"]
else "",
"_hidden": hidden, "_hidden": hidden,
"_module_target": e["target_html"], "_module_target": e["target_html"],
# '_module_help' : , # '_module_help' : ,

View File

@ -587,7 +587,7 @@ class ParcoursILEPS(TypeParcours):
# SESSION_ABBRV = 'A' # A1, A2, ... # SESSION_ABBRV = 'A' # A1, A2, ...
COMPENSATION_UE = False COMPENSATION_UE = False
UNUSED_CODES = set((ADC, ATT, ATB, ATJ)) UNUSED_CODES = set((ADC, ATT, ATB, ATJ))
ALLOWED_UE_TYPES = [UE_STANDARD, UE_OPTIONNELLE] ALLOWED_UE_TYPES = [UE_STANDARD, UE_OPTIONNELLE, UE_SPORT]
# Barre moy gen. pour validation semestre: # Barre moy gen. pour validation semestre:
BARRE_MOY = 10.0 BARRE_MOY = 10.0
# Barre pour UE ILEPS: 8/20 pour UE standards ("fondamentales") # Barre pour UE ILEPS: 8/20 pour UE standards ("fondamentales")

View File

@ -276,7 +276,7 @@ class Logo:
if self.mm is None: if self.mm is None:
return f'<logo name="{self.logoname}" width="?? mm" height="?? mm">' return f'<logo name="{self.logoname}" width="?? mm" height="?? mm">'
else: else:
return f'<logo name="{self.logoname}" width="{self.mm[0]}mm"">' return f'<logo name="{self.logoname}" width="{self.mm[0]}mm">'
def last_modified(self): def last_modified(self):
path = Path(self.filepath) path = Path(self.filepath)

View File

@ -1296,11 +1296,21 @@ class BasePreferences(object):
"labels": ["non", "oui"], "labels": ["non", "oui"],
}, },
), ),
(
"bul_show_ue_coef",
{
"initvalue": 1,
"title": "Afficher coefficient des UE sur les bulletins",
"input_type": "boolcheckbox",
"category": "bul",
"labels": ["non", "oui"],
},
),
( (
"bul_show_coef", "bul_show_coef",
{ {
"initvalue": 1, "initvalue": 1,
"title": "Afficher coefficient des ue/modules sur les bulletins", "title": "Afficher coefficient des modules sur les bulletins",
"input_type": "boolcheckbox", "input_type": "boolcheckbox",
"category": "bul", "category": "bul",
"labels": ["non", "oui"], "labels": ["non", "oui"],

View File

@ -304,8 +304,9 @@ def _return_logo(name="header", dept_id="", small=False, strict: bool = True):
# stockée dans /opt/scodoc-data/config/logos donc servie manuellement ici # stockée dans /opt/scodoc-data/config/logos donc servie manuellement ici
# from app.scodoc.sco_photos import _http_jpeg_file # from app.scodoc.sco_photos import _http_jpeg_file
logo = sco_logos.find_logo(name, dept_id, strict).select() logo = sco_logos.find_logo(name, dept_id, strict)
if logo is not None: if logo is not None:
logo.select()
suffix = logo.suffix suffix = logo.suffix
if small: if small:
with PILImage.open(logo.filepath) as im: with PILImage.open(logo.filepath) as im:

View File

@ -1,7 +1,7 @@
# -*- mode: python -*- # -*- mode: python -*-
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
SCOVERSION = "9.1.62" SCOVERSION = "9.1.63"
SCONAME = "ScoDoc" SCONAME = "ScoDoc"