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.models import FormSemestre, FormSemestreInscription, Identite
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_json import make_json_formsemestre_bulletinetud
from app.scodoc.sco_evaluation_db import do_evaluation_get_all_notes
from app.scodoc.sco_formations import formation_export
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_logos import list_logos, find_logo, _list_dept_logos
from app.scodoc.sco_moduleimpl import moduleimpl_list
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")
@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"])
@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"])
@bp.route("/absences/abs_signale?ine=<int:ine>&date=<string:date>&matin=<string:matin>&justif=<string:justif>"
"&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(
"/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"],
)
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
"""
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")
@ -843,16 +852,32 @@ def liste_logos(format="json"):
Liste des logos définis pour le site scodoc.
"""
# 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"])
def recup_logo_global(nom: str):
@bp.route("/logos/<string:logo_name>", methods=["GET"])
def recup_logo_global(logo_name: str):
"""
Retourne l'image au format png ou jpg
"""
# 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"])
@ -860,13 +885,32 @@ def logo_dept(dept: str):
"""
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"])
def recup_logo_dept_global(dept: str, nom: str):
@bp.route("/departement/<string:dept>/logos/<string:logo_name>", methods=["GET"])
def recup_logo_dept_global(dept: str, logo_name: str):
"""
L'image format png ou jpg
"""
# 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 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)"""
if not self.moyennes_matieres:
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:
"""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_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"]
colkeys = ["titre", "module"] # noms des colonnes à afficher
@ -409,7 +409,7 @@ class BulletinGeneratorStandard(sco_bulletins_generator.BulletinGenerator):
# Chaque UE:
for ue in I["ues"]:
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"]
rowstyle = ""
plusminus = minuslink #
@ -592,7 +592,7 @@ class BulletinGeneratorStandard(sco_bulletins_generator.BulletinGenerator):
"_titre_colspan": 2,
"rang": mod["mod_rang_txt"], # vide si pas option rang
"note": mod["mod_moy_txt"],
"coef": mod["mod_coef_txt"],
"coef": mod["mod_coef_txt"] if prefs["bul_show_coef"] else "",
"abs": mod.get(
"mod_abs_txt", ""
), # absent si pas option show abs module
@ -656,7 +656,9 @@ class BulletinGeneratorStandard(sco_bulletins_generator.BulletinGenerator):
eval_style = ""
t = {
"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,
"_module_target": e["target_html"],
# '_module_help' : ,

View File

@ -587,7 +587,7 @@ class ParcoursILEPS(TypeParcours):
# SESSION_ABBRV = 'A' # A1, A2, ...
COMPENSATION_UE = False
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 = 10.0
# Barre pour UE ILEPS: 8/20 pour UE standards ("fondamentales")

View File

@ -276,7 +276,7 @@ class Logo:
if self.mm is None:
return f'<logo name="{self.logoname}" width="?? mm" height="?? mm">'
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):
path = Path(self.filepath)

View File

@ -1296,11 +1296,21 @@ class BasePreferences(object):
"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",
{
"initvalue": 1,
"title": "Afficher coefficient des ue/modules sur les bulletins",
"title": "Afficher coefficient des modules sur les bulletins",
"input_type": "boolcheckbox",
"category": "bul",
"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
# 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:
logo.select()
suffix = logo.suffix
if small:
with PILImage.open(logo.filepath) as im:

View File

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