Merge branch 'dev92' of https://scodoc.org/git/ScoDoc/ScoDoc into api

This commit is contained in:
leonard_montalbano 2022-04-11 09:23:08 +02:00
commit 1841fdf896
30 changed files with 1051 additions and 1144 deletions

View File

@ -418,17 +418,46 @@ class BonusAmiens(BonusSportAdditif):
class BonusBethune(BonusSportMultiplicatif): class BonusBethune(BonusSportMultiplicatif):
"""Calcul bonus modules optionnels (sport), règle IUT de Béthune. """
Calcul bonus modules optionnels (sport, culture), règle IUT de Béthune.
Les points au dessus de la moyenne de 10 apportent un bonus pour le semestre. <p>
Ce bonus est égal au nombre de points divisé par 200 et multiplié par la <b>Pour le BUT :</b>
moyenne générale du semestre de l'étudiant. La note de sport est sur 20, et on calcule une bonification (en %)
qui va s'appliquer à <b>la moyenne de chaque UE</b> du semestre en appliquant
la formule : bonification (en %) = max(note-10, 0)*(1/<b>500</b>).
</p><p>
<em>La bonification ne s'applique que si la note est supérieure à 10.</em>
</p><p>
(Une note de 10 donne donc 0% de bonif,
1 point au dessus de 10 augmente la moyenne des UE de 0.2%)
</p>
<p>
<b>Pour le DUT/LP :</b>
La note de sport est sur 20, et on calcule une bonification (en %)
qui va s'appliquer à <b>la moyenne générale</b> du semestre en appliquant
la formule : bonification (en %) = max(note-10, 0)*(1/<b>200</b>).
</p><p>
<em>La bonification ne s'applique que si la note est supérieure à 10.</em>
</p><p>
(Une note de 10 donne donc 0% de bonif,
1 point au dessus de 10 augmente la moyenne des UE de 0.5%)
</p>
""" """
name = "bonus_iutbethune" name = "bonus_iutbethune"
displayed_name = "IUT de Béthune" displayed_name = "IUT de Béthune"
seuil_moy_gen = 10.0 seuil_moy_gen = 10.0 # points comptés au dessus de 10.
amplitude = 0.005
def compute_bonus(self, sem_modimpl_moys_inscrits, modimpl_coefs_etuds_no_nan):
"""calcul du bonus"""
if self.formsemestre.formation.is_apc():
self.amplitude = 0.002
else:
self.amplitude = 0.005
return super().compute_bonus(
sem_modimpl_moys_inscrits, modimpl_coefs_etuds_no_nan
)
class BonusBezier(BonusSportAdditif): class BonusBezier(BonusSportAdditif):

View File

@ -92,6 +92,8 @@ class ModuleImplResults:
ou NaN si les évaluations (dans lesquelles l'étudiant a des notes) ou NaN si les évaluations (dans lesquelles l'étudiant a des notes)
ne donnent pas de coef vers cette UE. ne donnent pas de coef vers cette UE.
""" """
self.evals_etudids_sans_note = {}
"""dict: evaluation_id : set des etudids non notés dans cette eval, sans les démissions."""
self.load_notes() self.load_notes()
self.etuds_use_session2 = pd.Series(False, index=self.evals_notes.index) self.etuds_use_session2 = pd.Series(False, index=self.evals_notes.index)
"""1 bool par etud, indique si sa moyenne de module vient de la session2""" """1 bool par etud, indique si sa moyenne de module vient de la session2"""
@ -142,12 +144,13 @@ class ModuleImplResults:
# ou évaluation déclarée "à prise en compte immédiate" # ou évaluation déclarée "à prise en compte immédiate"
# Les évaluations de rattrapage et 2eme session sont toujours incomplètes # Les évaluations de rattrapage et 2eme session sont toujours incomplètes
# car on calcule leur moyenne à part. # car on calcule leur moyenne à part.
etudids_sans_note = inscrits_module - set(eval_df.index) # sans les dem.
is_complete = (evaluation.evaluation_type == scu.EVALUATION_NORMALE) and ( is_complete = (evaluation.evaluation_type == scu.EVALUATION_NORMALE) and (
evaluation.publish_incomplete evaluation.publish_incomplete or (not etudids_sans_note)
or (not (inscrits_module - set(eval_df.index)))
) )
self.evaluations_completes.append(is_complete) self.evaluations_completes.append(is_complete)
self.evaluations_completes_dict[evaluation.id] = is_complete self.evaluations_completes_dict[evaluation.id] = is_complete
self.evals_etudids_sans_note[evaluation.id] = etudids_sans_note
# NULL en base => ABS (= -999) # NULL en base => ABS (= -999)
eval_df.fillna(scu.NOTES_ABSENCE, inplace=True) eval_df.fillna(scu.NOTES_ABSENCE, inplace=True)
@ -193,7 +196,9 @@ class ModuleImplResults:
return eval_df return eval_df
def _etudids(self): def _etudids(self):
"""L'index du dataframe est la liste de tous les étudiants inscrits au semestre""" """L'index du dataframe est la liste de tous les étudiants inscrits au semestre
(incluant les DEM et DEF)
"""
return [ return [
inscr.etudid inscr.etudid
for inscr in ModuleImpl.query.get( for inscr in ModuleImpl.query.get(

View File

@ -18,7 +18,7 @@ from app.auth.models import User
from app.comp.res_cache import ResultatsCache from app.comp.res_cache import ResultatsCache
from app.comp import res_sem from app.comp import res_sem
from app.comp.moy_mod import ModuleImplResults from app.comp.moy_mod import ModuleImplResults
from app.models import FormSemestre, FormSemestreUECoef from app.models import FormSemestre, FormSemestreUECoef, formsemestre
from app.models import Identite from app.models import Identite
from app.models import ModuleImpl, ModuleImplInscription from app.models import ModuleImpl, ModuleImplInscription
from app.models.ues import UniteEns from app.models.ues import UniteEns
@ -388,7 +388,9 @@ class ResultatsSemestre(ResultatsCache):
# --- TABLEAU RECAP # --- TABLEAU RECAP
def get_table_recap(self, convert_values=False, include_evaluations=False): def get_table_recap(
self, convert_values=False, include_evaluations=False, modejury=False
):
"""Result: tuple avec """Result: tuple avec
- rows: liste de dicts { column_id : value } - rows: liste de dicts { column_id : value }
- titles: { column_id : title } - titles: { column_id : title }
@ -538,21 +540,25 @@ class ResultatsSemestre(ResultatsCache):
titles_bot[ titles_bot[
f"_{col_id}_target_attrs" f"_{col_id}_target_attrs"
] = f"""title="{ue.titre} S{ue.semestre_idx or '?'}" """ ] = f"""title="{ue.titre} S{ue.semestre_idx or '?'}" """
if modejury:
# pas d'autre colonnes de résultats
continue
# Bonus (sport) dans cette UE ? # Bonus (sport) dans cette UE ?
# Le bonus sport appliqué sur cette UE # Le bonus sport appliqué sur cette UE
if (self.bonus_ues is not None) and (ue.id in self.bonus_ues): if (self.bonus_ues is not None) and (ue.id in self.bonus_ues):
val = self.bonus_ues[ue.id][etud.id] or "" val = self.bonus_ues[ue.id][etud.id] or ""
val_fmt = fmt_note(val) val_fmt = val_fmt_html = fmt_note(val)
if val: if val:
val_fmt = f'<span class="green-arrow-up"></span><span class="sp2l">{val_fmt}</span>' val_fmt_html = f'<span class="green-arrow-up"></span><span class="sp2l">{val_fmt}</span>'
idx = add_cell( idx = add_cell(
row, row,
f"bonus_ue_{ue.id}", f"bonus_ue_{ue.id}",
f"Bonus {ue.acronyme}", f"Bonus {ue.acronyme}",
val_fmt, val_fmt_html,
"col_ue_bonus", "col_ue_bonus",
idx, idx,
) )
row[f"_bonus_ue_{ue.id}_xls"] = val_fmt
# Les moyennes des modules (ou ressources et SAÉs) dans cette UE # Les moyennes des modules (ou ressources et SAÉs) dans cette UE
idx_malus = idx # place pour colonne malus à gauche des modules idx_malus = idx # place pour colonne malus à gauche des modules
idx += 1 idx += 1
@ -581,20 +587,21 @@ class ResultatsSemestre(ResultatsCache):
col_id = ( col_id = (
f"moy_{modimpl.module.type_abbrv()}_{modimpl.id}_{ue.id}" f"moy_{modimpl.module.type_abbrv()}_{modimpl.id}_{ue.id}"
) )
val_fmt = fmt_note(val) val_fmt = val_fmt_html = fmt_note(val)
if modimpl.module.module_type == scu.ModuleType.MALUS: if modimpl.module.module_type == scu.ModuleType.MALUS:
val_fmt = ( val_fmt_html = (
(scu.EMO_RED_TRIANGLE_DOWN + val_fmt) if val else "" (scu.EMO_RED_TRIANGLE_DOWN + val_fmt) if val else ""
) )
idx = add_cell( idx = add_cell(
row, row,
col_id, col_id,
modimpl.module.code, modimpl.module.code,
val_fmt, val_fmt_html,
# class col_res mod_ue_123 # class col_res mod_ue_123
f"col_{modimpl.module.type_abbrv()} mod_ue_{ue.id}", f"col_{modimpl.module.type_abbrv()} mod_ue_{ue.id}",
idx, idx,
) )
row[f"_{col_id}_xls"] = val_fmt
if modimpl.module.module_type == scu.ModuleType.MALUS: if modimpl.module.module_type == scu.ModuleType.MALUS:
titles[f"_{col_id}_col_order"] = idx_malus titles[f"_{col_id}_col_order"] = idx_malus
titles_bot[f"_{col_id}_target"] = url_for( titles_bot[f"_{col_id}_target"] = url_for(
@ -611,22 +618,37 @@ class ResultatsSemestre(ResultatsCache):
f"_{col_id}_target_attrs" f"_{col_id}_target_attrs"
] = f""" title="{modimpl.module.titre} ({nom_resp})" """ ] = f""" title="{modimpl.module.titre} ({nom_resp})" """
modimpl_ids.add(modimpl.id) modimpl_ids.add(modimpl.id)
ue_valid_txt = f"{nb_ues_validables}/{len(ues_sans_bonus)}" ue_valid_txt = (
ue_valid_txt_html
) = f"{nb_ues_validables}/{len(ues_sans_bonus)}"
if nb_ues_warning: if nb_ues_warning:
ue_valid_txt += " " + scu.EMO_WARNING ue_valid_txt_html += " " + scu.EMO_WARNING
add_cell( add_cell(
row, row,
"ues_validables", "ues_validables",
"UEs", "UEs",
ue_valid_txt, ue_valid_txt_html,
"col_ue col_ues_validables", "col_ue col_ues_validables",
29, # juste avant moy. gen. 29, # juste avant moy. gen.
) )
row["_ues_validables_xls"] = ue_valid_txt
if nb_ues_warning: if nb_ues_warning:
row["_ues_validables_class"] += " moy_ue_warning" row["_ues_validables_class"] += " moy_ue_warning"
elif nb_ues_validables < len(ues_sans_bonus): elif nb_ues_validables < len(ues_sans_bonus):
row["_ues_validables_class"] += " moy_inf" row["_ues_validables_class"] += " moy_inf"
row["_ues_validables_order"] = nb_ues_validables # pour tri row["_ues_validables_order"] = nb_ues_validables # pour tri
if modejury:
idx = add_cell(
row,
"jury_link",
"",
f"""<a href="{url_for('notes.formsemestre_validation_etud_form',
scodoc_dept=g.scodoc_dept, formsemestre_id=self.formsemestre.id, etudid=etudid
)
}">saisir décision</a>""",
"col_jury_link",
1000,
)
rows.append(row) rows.append(row)
self._recap_add_partitions(rows, titles) self._recap_add_partitions(rows, titles)
@ -658,7 +680,7 @@ class ResultatsSemestre(ResultatsCache):
row["_moy_gen_class"] = "col_moy_gen" row["_moy_gen_class"] = "col_moy_gen"
# titre de la ligne: # titre de la ligne:
row["prenom"] = row["nom_short"] = ( row["prenom"] = row["nom_short"] = (
row.get(f"_title", "") or bottom_line.capitalize() row.get("_title", "") or bottom_line.capitalize()
) )
row["_tr_class"] = bottom_line.lower() + ( row["_tr_class"] = bottom_line.lower() + (
(" " + row["_tr_class"]) if "_tr_class" in row else "" (" " + row["_tr_class"]) if "_tr_class" in row else ""
@ -840,20 +862,27 @@ class ResultatsSemestre(ResultatsCache):
"_tr_class": "bottom_info", "_tr_class": "bottom_info",
"_title": "Description évaluation", "_title": "Description évaluation",
} }
first = True first_eval = True
index_col = 9000 # à droite
for modimpl in self.formsemestre.modimpls_sorted: for modimpl in self.formsemestre.modimpls_sorted:
evals = self.modimpls_results[modimpl.id].get_evaluations_completes(modimpl) evals = self.modimpls_results[modimpl.id].get_evaluations_completes(modimpl)
eval_index = len(evals) - 1 eval_index = len(evals) - 1
inscrits = {i.etudid for i in modimpl.inscriptions} inscrits = {i.etudid for i in modimpl.inscriptions}
klass = "evaluation first" if first else "evaluation" first_eval_of_mod = True
first = False for e in evals:
for i, e in enumerate(evals):
cid = f"eval_{e.id}" cid = f"eval_{e.id}"
titles[ titles[
cid cid
] = f'{modimpl.module.code} {eval_index} {e.jour.isoformat() if e.jour else ""}' ] = f'{modimpl.module.code} {eval_index} {e.jour.isoformat() if e.jour else ""}'
klass = "evaluation"
if first_eval:
klass += " first"
elif first_eval_of_mod:
klass += " first_of_mod"
titles[f"_{cid}_class"] = klass titles[f"_{cid}_class"] = klass
titles[f"_{cid}_col_order"] = 9000 + i # à droite first_eval_of_mod = first_eval = False
titles[f"_{cid}_col_order"] = index_col
index_col += 1
eval_index -= 1 eval_index -= 1
notes_db = sco_evaluation_db.do_evaluation_get_all_notes( notes_db = sco_evaluation_db.do_evaluation_get_all_notes(
e.evaluation_id e.evaluation_id
@ -867,8 +896,21 @@ class ResultatsSemestre(ResultatsCache):
# Note manquante mais prise en compte immédiate: affiche ATT # Note manquante mais prise en compte immédiate: affiche ATT
val = scu.NOTES_ATTENTE val = scu.NOTES_ATTENTE
row[cid] = scu.fmt_note(val) row[cid] = scu.fmt_note(val)
row[f"_{cid}_class"] = klass row[f"_{cid}_class"] = klass + {
"ABS": " abs",
"ATT": " att",
"EXC": " exc",
}.get(row[cid], "")
else:
row[cid] = "ni"
row[f"_{cid}_class"] = klass + " non_inscrit"
bottom_infos["coef"][cid] = e.coefficient bottom_infos["coef"][cid] = e.coefficient
bottom_infos["min"][cid] = "0" bottom_infos["min"][cid] = "0"
bottom_infos["max"][cid] = scu.fmt_note(e.note_max) bottom_infos["max"][cid] = scu.fmt_note(e.note_max)
bottom_infos["descr_evaluation"][cid] = e.description or "" bottom_infos["descr_evaluation"][cid] = e.description or ""
bottom_infos["descr_evaluation"][f"_{cid}_target"] = url_for(
"notes.evaluation_listenotes",
scodoc_dept=g.scodoc_dept,
evaluation_id=e.id,
)

View File

@ -74,6 +74,10 @@ class GroupDescr(db.Model):
f"""<{self.__class__.__name__} {self.id} "{self.group_name or '(tous)'}">""" f"""<{self.__class__.__name__} {self.id} "{self.group_name or '(tous)'}">"""
) )
def get_nom_with_part(self) -> str:
"Nom avec partition: 'TD A'"
return f"{self.partition.partition_name or ''} {self.group_name or '-'}"
group_membership = db.Table( group_membership = db.Table(
"group_membership", "group_membership",

View File

@ -9,7 +9,6 @@ from app.comp import df_cache
from app.models.etudiants import Identite from app.models.etudiants import Identite
from app.models.modules import Module from app.models.modules import Module
import app.scodoc.notesdb as ndb
from app.scodoc import sco_utils as scu from app.scodoc import sco_utils as scu

View File

@ -209,7 +209,8 @@ class GenTable(object):
omit_hidden_lines=False, omit_hidden_lines=False,
pdf_mode=False, # apply special pdf reportlab processing pdf_mode=False, # apply special pdf reportlab processing
pdf_style_list=[], # modified: list of platypus table style commands pdf_style_list=[], # modified: list of platypus table style commands
): xls_mode=False, # get xls content if available
) -> list:
"table data as a list of lists (rows)" "table data as a list of lists (rows)"
T = [] T = []
line_num = 0 # line number in input data line_num = 0 # line number in input data
@ -237,9 +238,14 @@ class GenTable(object):
# if colspan_count > 0: # if colspan_count > 0:
# continue # skip cells after a span # continue # skip cells after a span
if pdf_mode: if pdf_mode:
content = row.get(f"_{cid}_pdf", "") or row.get(cid, "") or "" content = row.get(f"_{cid}_pdf", False) or row.get(cid, "")
elif xls_mode:
content = row.get(f"_{cid}_xls", False) or row.get(cid, "")
else: else:
content = row.get(cid, "") or "" # nota: None converted to '' content = row.get(cid, "")
# Convert None to empty string ""
content = "" if content is None else content
colspan = row.get("_%s_colspan" % cid, 0) colspan = row.get("_%s_colspan" % cid, 0)
if colspan > 1: if colspan > 1:
pdf_style_list.append( pdf_style_list.append(
@ -299,7 +305,7 @@ class GenTable(object):
return self.xml() return self.xml()
elif format == "json": elif format == "json":
return self.json() return self.json()
raise ValueError("GenTable: invalid format: %s" % format) raise ValueError(f"GenTable: invalid format: {format}")
def _gen_html_row(self, row, line_num=0, elem="td", css_classes=""): def _gen_html_row(self, row, line_num=0, elem="td", css_classes=""):
"row is a dict, returns a string <tr...>...</tr>" "row is a dict, returns a string <tr...>...</tr>"
@ -479,23 +485,23 @@ class GenTable(object):
def excel(self, wb=None): def excel(self, wb=None):
"""Simple Excel representation of the table""" """Simple Excel representation of the table"""
if wb is None: if wb is None:
ses = sco_excel.ScoExcelSheet(sheet_name=self.xls_sheet_name, wb=wb) sheet = sco_excel.ScoExcelSheet(sheet_name=self.xls_sheet_name, wb=wb)
else: else:
ses = wb.create_sheet(sheet_name=self.xls_sheet_name) sheet = wb.create_sheet(sheet_name=self.xls_sheet_name)
ses.rows += self.xls_before_table sheet.rows += self.xls_before_table
style_bold = sco_excel.excel_make_style(bold=True) style_bold = sco_excel.excel_make_style(bold=True)
style_base = sco_excel.excel_make_style() style_base = sco_excel.excel_make_style()
ses.append_row(ses.make_row(self.get_titles_list(), style_bold)) sheet.append_row(sheet.make_row(self.get_titles_list(), style_bold))
for line in self.get_data_list(): for line in self.get_data_list(xls_mode=True):
ses.append_row(ses.make_row(line, style_base)) sheet.append_row(sheet.make_row(line, style_base))
if self.caption: if self.caption:
ses.append_blank_row() # empty line sheet.append_blank_row() # empty line
ses.append_single_cell_row(self.caption, style_base) sheet.append_single_cell_row(self.caption, style_base)
if self.origin: if self.origin:
ses.append_blank_row() # empty line sheet.append_blank_row() # empty line
ses.append_single_cell_row(self.origin, style_base) sheet.append_single_cell_row(self.origin, style_base)
if wb is None: if wb is None:
return ses.generate() return sheet.generate()
def text(self): def text(self):
"raw text representation of the table" "raw text representation of the table"

View File

@ -86,9 +86,9 @@ def sidebar():
f"""<div class="sidebar"> f"""<div class="sidebar">
{ sidebar_common() } { sidebar_common() }
<div class="box-chercheetud">Chercher étudiant:<br/> <div class="box-chercheetud">Chercher étudiant:<br/>
<form method="get" id="form-chercheetud" <form method="get" id="form-chercheetud"
action="{ url_for('scolar.search_etud_in_dept', scodoc_dept=g.scodoc_dept) }"> action="{url_for('scolar.search_etud_in_dept', scodoc_dept=g.scodoc_dept) }">
<div><input type="text" size="12" id="in-expnom" name="expnom" spellcheck="false"></input></div> <div><input type="text" size="12" class="in-expnom" name="expnom" spellcheck="false"></input></div>
</form></div> </form></div>
<div class="etud-insidebar"> <div class="etud-insidebar">
""" """

View File

@ -31,9 +31,7 @@
import calendar import calendar
import datetime import datetime
import html import html
import string
import time import time
import types
from app.scodoc import notesdb as ndb from app.scodoc import notesdb as ndb
from app import log from app import log
@ -42,9 +40,9 @@ from app.scodoc.sco_exceptions import ScoValueError, ScoInvalidDateError
from app.scodoc import sco_abs_notification from app.scodoc import sco_abs_notification
from app.scodoc import sco_cache from app.scodoc import sco_cache
from app.scodoc import sco_etud from app.scodoc import sco_etud
from app.scodoc import sco_formsemestre
from app.scodoc import sco_formsemestre_inscriptions from app.scodoc import sco_formsemestre_inscriptions
from app.scodoc import sco_preferences from app.scodoc import sco_preferences
import app.scodoc.sco_utils as scu
# --- Misc tools.... ------------------ # --- Misc tools.... ------------------
@ -247,9 +245,9 @@ def day_names():
If work_saturday property is set, include saturday If work_saturday property is set, include saturday
""" """
if is_work_saturday(): if is_work_saturday():
return ["Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi"] return scu.DAY_NAMES[:-1]
else: else:
return ["Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi"] return scu.DAY_NAMES[:-2]
def next_iso_day(date): def next_iso_day(date):

View File

@ -47,14 +47,15 @@
qui est une description (humaine, format libre) de l'archive. qui est une description (humaine, format libre) de l'archive.
""" """
import chardet
import datetime import datetime
import glob import glob
import json
import mimetypes import mimetypes
import os import os
import re import re
import shutil import shutil
import time import time
import chardet
import flask import flask
from flask import g, request from flask import g, request
@ -63,7 +64,9 @@ from flask_login import current_user
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
from config import Config from config import Config
from app import log from app import log
from app.models import Departement from app.comp import res_sem
from app.comp.res_compat import NotesTableCompat
from app.models import Departement, FormSemestre
from app.scodoc.TrivialFormulator import TrivialFormulator from app.scodoc.TrivialFormulator import TrivialFormulator
from app.scodoc.sco_exceptions import ( from app.scodoc.sco_exceptions import (
AccessDenied, AccessDenied,
@ -95,8 +98,8 @@ class BaseArchiver(object):
self.root = os.path.join(*dirs) self.root = os.path.join(*dirs)
log("initialized archiver, path=" + self.root) log("initialized archiver, path=" + self.root)
path = dirs[0] path = dirs[0]
for dir in dirs[1:]: for directory in dirs[1:]:
path = os.path.join(path, dir) path = os.path.join(path, directory)
try: try:
scu.GSL.acquire() scu.GSL.acquire()
if not os.path.isdir(path): if not os.path.isdir(path):
@ -117,11 +120,11 @@ class BaseArchiver(object):
try: try:
scu.GSL.acquire() scu.GSL.acquire()
if not os.path.isdir(dept_dir): if not os.path.isdir(dept_dir):
log("creating directory %s" % dept_dir) log(f"creating directory {dept_dir}")
os.mkdir(dept_dir) os.mkdir(dept_dir)
obj_dir = os.path.join(dept_dir, str(oid)) obj_dir = os.path.join(dept_dir, str(oid))
if not os.path.isdir(obj_dir): if not os.path.isdir(obj_dir):
log("creating directory %s" % obj_dir) log(f"creating directory {obj_dir}")
os.mkdir(obj_dir) os.mkdir(obj_dir)
finally: finally:
scu.GSL.release() scu.GSL.release()
@ -163,8 +166,9 @@ class BaseArchiver(object):
def get_archive_date(self, archive_id): def get_archive_date(self, archive_id):
"""Returns date (as a DateTime object) of an archive""" """Returns date (as a DateTime object) of an archive"""
dt = [int(x) for x in os.path.split(archive_id)[1].split("-")] return datetime.datetime(
return datetime.datetime(*dt) *[int(x) for x in os.path.split(archive_id)[1].split("-")]
)
def list_archive(self, archive_id: str) -> str: def list_archive(self, archive_id: str) -> str:
"""Return list of filenames (without path) in archive""" """Return list of filenames (without path) in archive"""
@ -195,8 +199,7 @@ class BaseArchiver(object):
archive_id = os.path.join(self.get_obj_dir(oid), archive_name) archive_id = os.path.join(self.get_obj_dir(oid), archive_name)
if not os.path.isdir(archive_id): if not os.path.isdir(archive_id):
log( log(
"invalid archive name: %s, oid=%s, archive_id=%s" f"invalid archive name: {archive_name}, oid={oid}, archive_id={archive_id}"
% (archive_name, oid, archive_id)
) )
raise ValueError("invalid archive name") raise ValueError("invalid archive name")
return archive_id return archive_id
@ -223,7 +226,7 @@ class BaseArchiver(object):
+ os.path.sep + os.path.sep
+ "-".join(["%02d" % x for x in time.localtime()[:6]]) + "-".join(["%02d" % x for x in time.localtime()[:6]])
) )
log("creating archive: %s" % archive_id) log(f"creating archive: {archive_id}")
try: try:
scu.GSL.acquire() scu.GSL.acquire()
os.mkdir(archive_id) # if exists, raises an OSError os.mkdir(archive_id) # if exists, raises an OSError
@ -302,9 +305,14 @@ def do_formsemestre_archive(
Store: Store:
- tableau recap (xls), pv jury (xls et pdf), bulletins (xml et pdf), lettres individuelles (pdf) - tableau recap (xls), pv jury (xls et pdf), bulletins (xml et pdf), lettres individuelles (pdf)
""" """
from app.scodoc.sco_recapcomplet import make_formsemestre_recapcomplet from app.scodoc.sco_recapcomplet import (
gen_formsemestre_recapcomplet_excel,
gen_formsemestre_recapcomplet_html,
gen_formsemestre_recapcomplet_json,
)
sem = sco_formsemestre.get_formsemestre(formsemestre_id) formsemestre = FormSemestre.query.get_or_404(formsemestre_id)
res: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre)
sem_archive_id = formsemestre_id sem_archive_id = formsemestre_id
archive_id = PVArchive.create_obj_archive(sem_archive_id, description) archive_id = PVArchive.create_obj_archive(sem_archive_id, description)
date = PVArchive.get_archive_date(archive_id).strftime("%d/%m/%Y à %H:%M") date = PVArchive.get_archive_date(archive_id).strftime("%d/%m/%Y à %H:%M")
@ -319,37 +327,38 @@ def do_formsemestre_archive(
etudids = [m["etudid"] for m in groups_infos.members] etudids = [m["etudid"] for m in groups_infos.members]
# Tableau recap notes en XLS (pour tous les etudiants, n'utilise pas les groupes) # Tableau recap notes en XLS (pour tous les etudiants, n'utilise pas les groupes)
data, _, _ = make_formsemestre_recapcomplet(formsemestre_id, format="xls") data, _ = gen_formsemestre_recapcomplet_excel(
formsemestre, res, include_evaluations=True, format="xls"
)
if data: if data:
PVArchive.store(archive_id, "Tableau_moyennes" + scu.XLSX_SUFFIX, data) PVArchive.store(archive_id, "Tableau_moyennes" + scu.XLSX_SUFFIX, data)
# Tableau recap notes en HTML (pour tous les etudiants, n'utilise pas les groupes) # Tableau recap notes en HTML (pour tous les etudiants, n'utilise pas les groupes)
data, _, _ = make_formsemestre_recapcomplet( table_html = gen_formsemestre_recapcomplet_html(
formsemestre_id, format="html", disable_etudlink=True formsemestre, res, include_evaluations=True
) )
if data: if table_html:
data = "\n".join( data = "\n".join(
[ [
html_sco_header.sco_header( html_sco_header.sco_header(
page_title="Moyennes archivées le %s" % date, page_title=f"Moyennes archivées le {date}",
head_message="Moyennes archivées le %s" % date, head_message=f"Moyennes archivées le {date}",
no_side_bar=True, no_side_bar=True,
), ),
'<h2 class="fontorange">Valeurs archivées le %s</h2>' % date, f'<h2 class="fontorange">Valeurs archivées le {date}</h2>',
'<style type="text/css">table.notes_recapcomplet tr { color: rgb(185,70,0); }</style>', '<style type="text/css">table.notes_recapcomplet tr { color: rgb(185,70,0); }</style>',
data, table_html,
html_sco_header.sco_footer(), html_sco_header.sco_footer(),
] ]
) )
data = data.encode(scu.SCO_ENCODING) data = data.encode(scu.SCO_ENCODING)
PVArchive.store(archive_id, "Tableau_moyennes.html", data) PVArchive.store(archive_id, "Tableau_moyennes.html", data)
# Bulletins en XML (pour tous les etudiants, n'utilise pas les groupes) # Bulletins en JSON
data, _, _ = make_formsemestre_recapcomplet( data = gen_formsemestre_recapcomplet_json(formsemestre_id, xml_with_decisions=True)
formsemestre_id, format="xml", xml_with_decisions=True data_js = json.dumps(data, indent=1, cls=scu.ScoDocJSONEncoder)
) data_js = data_js.encode(scu.SCO_ENCODING)
if data: if data:
data = data.encode(scu.SCO_ENCODING) PVArchive.store(archive_id, "Bulletins.json", data_js)
PVArchive.store(archive_id, "Bulletins.xml", data)
# Decisions de jury, en XLS # Decisions de jury, en XLS
data = sco_pvjury.formsemestre_pvjury(formsemestre_id, format="xls", publish=False) data = sco_pvjury.formsemestre_pvjury(formsemestre_id, format="xls", publish=False)
if data: if data:

View File

@ -25,7 +25,7 @@
# #
############################################################################## ##############################################################################
"""Vérification des abasneces à une évaluation """Vérification des absences à une évaluation
""" """
from flask import url_for, g from flask import url_for, g

View File

@ -0,0 +1,144 @@
##############################################################################
# ScoDoc
# Copyright (c) 1999 - 2022 Emmanuel Viennet. All rights reserved.
# See LICENSE
##############################################################################
"""Tableau recap. de toutes les évaluations d'un semestre
avec leur état.
Sur une idée de Pascal Bouron, de Lyon.
"""
import time
from flask import g, url_for
from app.models import Evaluation, FormSemestre
from app.comp import res_sem
from app.comp.res_compat import NotesTableCompat
from app.comp.moy_mod import ModuleImplResults
from app.scodoc import html_sco_header
import app.scodoc.sco_utils as scu
def evaluations_recap(formsemestre_id: int) -> str:
"""Page récap. de toutes les évaluations d'un semestre"""
formsemestre: FormSemestre = FormSemestre.query.get_or_404(formsemestre_id)
rows, titles = evaluations_recap_table(formsemestre)
column_ids = titles.keys()
filename = scu.sanitize_filename(
f"""evaluations-{formsemestre.titre_num()}-{time.strftime("%Y-%m-%d")}"""
)
if not rows:
return '<div class="evaluations_recap"><div class="message">aucune évaluation</div></div>'
H = [
html_sco_header.sco_header(
page_title="Évaluations du semestre",
javascripts=["js/evaluations_recap.js"],
),
f"""<div class="evaluations_recap"><table class="evaluations_recap compact {
'apc' if formsemestre.formation.is_apc() else 'classic'
}"
data-filename="{filename}">""",
]
# header
H.append(
f"""
<thead>
{scu.gen_row(column_ids, titles, "th", with_col_classes=True)}
</thead>
"""
)
# body
H.append("<tbody>")
for row in rows:
H.append(f"{scu.gen_row(column_ids, row, with_col_classes=True)}\n")
H.append("""</tbody></table></div>""")
H.append(
html_sco_header.sco_footer(),
)
return "".join(H)
def evaluations_recap_table(formsemestre: FormSemestre) -> list[dict]:
"""Tableau recap. de toutes les évaluations d'un semestre
Colonnes:
- code (UE ou module),
- titre
- complete
- publiée
- inscrits (non dem. ni def.)
- nb notes manquantes
- nb ATT
- nb ABS
- nb EXC
"""
rows = []
titles = {
"type": "",
"code": "Code",
"titre": "",
"date": "Date",
"complete": "Comptée",
"inscrits": "Inscrits",
"manquantes": "Manquantes", # notes eval non entrées
"nb_abs": "ABS",
"nb_att": "ATT",
"nb_exc": "EXC",
}
nt: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre)
line_idx = 0
for modimpl in nt.formsemestre.modimpls_sorted:
modimpl_results: ModuleImplResults = nt.modimpls_results[modimpl.id]
row = {
"type": modimpl.module.type_abbrv().upper(),
"_type_order": f"{line_idx:04d}",
"code": modimpl.module.code,
"_code_target": url_for(
"notes.moduleimpl_status",
scodoc_dept=g.scodoc_dept,
moduleimpl_id=modimpl.id,
),
"titre": modimpl.module.titre,
"_titre_class": "titre",
"inscrits": modimpl_results.nb_inscrits_module,
"date": "-",
"_date_order": "",
"_tr_class": f"module {modimpl.module.type_abbrv()}",
}
rows.append(row)
line_idx += 1
for evaluation_id in modimpl_results.evals_notes:
e = Evaluation.query.get(evaluation_id)
eval_etat = modimpl_results.evaluations_etat[evaluation_id]
row = {
"type": "",
"_type_order": f"{line_idx:04d}",
"titre": e.description or "sans titre",
"_titre_target": url_for(
"notes.evaluation_listenotes",
scodoc_dept=g.scodoc_dept,
evaluation_id=evaluation_id,
),
"_titre_target_attrs": 'class="discretelink"',
"date": e.jour.strftime("%d/%m/%Y") if e.jour else "",
"_date_order": e.jour.isoformat() if e.jour else "",
"complete": "oui" if eval_etat.is_complete else "non",
"_complete_target": "#",
"_complete_target_attrs": 'class="bull_link" title="prise en compte dans les moyennes"'
if eval_etat.is_complete
else 'class="bull_link incomplete" title="il manque des notes"',
"manquantes": len(modimpl_results.evals_etudids_sans_note[e.id]),
"inscrits": modimpl_results.nb_inscrits_module,
"nb_abs": sum(modimpl_results.evals_notes[e.id] == scu.NOTES_ABSENCE),
"nb_att": eval_etat.nb_attente,
"nb_exc": sum(
modimpl_results.evals_notes[e.id] == scu.NOTES_NEUTRALISE
),
"_tr_class": "evaluation"
+ (" incomplete" if not eval_etat.is_complete else ""),
}
rows.append(row)
line_idx += 1
return rows, titles

View File

@ -185,13 +185,13 @@ def excel_make_style(
class ScoExcelSheet: class ScoExcelSheet:
"""Représente une feuille qui peut être indépendante ou intégrée dans un SCoExcelBook. """Représente une feuille qui peut être indépendante ou intégrée dans un ScoExcelBook.
En application des directives de la bibliothèque sur l'écriture optimisée, l'ordre des opérations En application des directives de la bibliothèque sur l'écriture optimisée, l'ordre des opérations
est imposé: est imposé:
* instructions globales (largeur/maquage des colonnes et ligne, ...) * instructions globales (largeur/maquage des colonnes et ligne, ...)
* construction et ajout des cellules et ligne selon le sens de lecture (occidental) * construction et ajout des cellules et ligne selon le sens de lecture (occidental)
ligne de haut en bas et cellules de gauche à droite (i.e. A1, A2, .. B1, B2, ..) ligne de haut en bas et cellules de gauche à droite (i.e. A1, A2, .. B1, B2, ..)
* pour finit appel de la méthode de génération * pour finir appel de la méthode de génération
""" """
def __init__(self, sheet_name="feuille", default_style=None, wb=None): def __init__(self, sheet_name="feuille", default_style=None, wb=None):
@ -260,7 +260,7 @@ class ScoExcelSheet:
for i, val in enumerate(value): for i, val in enumerate(value):
self.ws.column_dimensions[self.i2col(i)].width = val self.ws.column_dimensions[self.i2col(i)].width = val
# No keys: value is a list of widths # No keys: value is a list of widths
elif type(cle) == str: # accepts set_column_with("D", ...) elif isinstance(cle, str): # accepts set_column_with("D", ...)
self.ws.column_dimensions[cle].width = value self.ws.column_dimensions[cle].width = value
else: else:
self.ws.column_dimensions[self.i2col(cle)].width = value self.ws.column_dimensions[self.i2col(cle)].width = value
@ -337,7 +337,8 @@ class ScoExcelSheet:
return cell return cell
def make_row(self, values: list, style=None, comments=None): def make_row(self, values: list, style=None, comments=None) -> list:
"build a row"
# TODO make possible differents styles in a row # TODO make possible differents styles in a row
if comments is None: if comments is None:
comments = [None] * len(values) comments = [None] * len(values)

View File

@ -53,12 +53,10 @@ def form_search_etud(
): ):
"form recherche par nom" "form recherche par nom"
H = [] H = []
if title:
H.append("<h2>%s</h2>" % title)
H.append( H.append(
f"""<form action="{ url_for("scolar.search_etud_in_dept", scodoc_dept=g.scodoc_dept) }" method="POST"> f"""<form action="{ url_for("scolar.search_etud_in_dept", scodoc_dept=g.scodoc_dept) }" method="POST">
<b>{title}</b> <b>{title}</b>
<input type="text" name="expnom" width="12" spellcheck="false" value=""> <input type="text" name="expnom" class="in-expnom" width="12" spellcheck="false" value="">
<input type="submit" value="Chercher"> <input type="submit" value="Chercher">
<br/>(entrer une partie du nom) <br/>(entrer une partie du nom)
""" """

View File

@ -357,6 +357,11 @@ def formsemestre_status_menubar(sem):
"endpoint": "notes.formsemestre_recapcomplet", "endpoint": "notes.formsemestre_recapcomplet",
"args": {"formsemestre_id": formsemestre_id}, "args": {"formsemestre_id": formsemestre_id},
}, },
{
"title": "État des évaluations",
"endpoint": "notes.evaluations_recap",
"args": {"formsemestre_id": formsemestre_id},
},
{ {
"title": "Saisie des notes", "title": "Saisie des notes",
"endpoint": "notes.formsemestre_status", "endpoint": "notes.formsemestre_status",
@ -404,9 +409,6 @@ def formsemestre_status_menubar(sem):
"args": { "args": {
"formsemestre_id": formsemestre_id, "formsemestre_id": formsemestre_id,
"modejury": 1, "modejury": 1,
"hidemodules": 1,
"hidebac": 1,
"pref_override": 0,
}, },
"enabled": sco_permissions_check.can_validate_sem(formsemestre_id), "enabled": sco_permissions_check.can_validate_sem(formsemestre_id),
}, },
@ -764,22 +766,29 @@ def _make_listes_sem(sem, with_absences=True):
if with_absences: if with_absences:
first_monday = sco_abs.ddmmyyyy(sem["date_debut"]).prev_monday() first_monday = sco_abs.ddmmyyyy(sem["date_debut"]).prev_monday()
form_abs_tmpl = f""" form_abs_tmpl = f"""
<td><form action="{url_for( <td>
<a href="%(url_etat)s">absences</a>
</td>
<td>
<form action="{url_for(
"absences.SignaleAbsenceGrSemestre", scodoc_dept=g.scodoc_dept "absences.SignaleAbsenceGrSemestre", scodoc_dept=g.scodoc_dept
)}" method="get"> )}" method="get">
<input type="hidden" name="datefin" value="{sem['date_fin']}"/> <input type="hidden" name="datefin" value="{sem['date_fin']}"/>
<input type="hidden" name="group_ids" value="%(group_id)s"/> <input type="hidden" name="group_ids" value="%(group_id)s"/>
<input type="hidden" name="destination" value="{destination}"/> <input type="hidden" name="destination" value="{destination}"/>
<input type="submit" value="Saisir absences du" /> <input type="submit" value="Saisir abs des" />
<select name="datedebut" class="noprint"> <select name="datedebut" class="noprint">
""" """
date = first_monday date = first_monday
for jour in sco_abs.day_names(): for jour in sco_abs.day_names():
form_abs_tmpl += '<option value="%s">%s</option>' % (date, jour) form_abs_tmpl += f'<option value="{date}">{jour}s</option>'
date = date.next_day() date = date.next_day()
form_abs_tmpl += """ form_abs_tmpl += f"""
</select> </select>
<a href="%(url_etat)s">état</a>
<a href="{
url_for("absences.choix_semaine", scodoc_dept=g.scodoc_dept)
}?group_id=%(group_id)s">saisie par semaine</a>
</form></td> </form></td>
""" """
else: else:
@ -791,7 +800,7 @@ def _make_listes_sem(sem, with_absences=True):
# Genere liste pour chaque partition (categorie de groupes) # Genere liste pour chaque partition (categorie de groupes)
for partition in sco_groups.get_partitions_list(sem["formsemestre_id"]): for partition in sco_groups.get_partitions_list(sem["formsemestre_id"]):
if not partition["partition_name"]: if not partition["partition_name"]:
H.append("<h4>Tous les étudiants</h4>" % partition) H.append("<h4>Tous les étudiants</h4>")
else: else:
H.append("<h4>Groupes de %(partition_name)s</h4>" % partition) H.append("<h4>Groupes de %(partition_name)s</h4>" % partition)
groups = sco_groups.get_partition_groups(partition) groups = sco_groups.get_partition_groups(partition)
@ -821,20 +830,6 @@ def _make_listes_sem(sem, with_absences=True):
) )
}">{group["label"]}</a> }">{group["label"]}</a>
</td><td> </td><td>
(<a href="{
url_for("scolar.groups_view",
group_ids=group["group_id"],
format="xls",
scodoc_dept=g.scodoc_dept,
)
}">tableur</a>)
<a href="{
url_for("scolar.groups_view",
curtab="tab-photos",
group_ids=group["group_id"],
scodoc_dept=g.scodoc_dept,
)
}">Photos</a>
</td> </td>
<td>({n_members} étudiants)</td> <td>({n_members} étudiants)</td>
""" """

View File

@ -31,6 +31,7 @@ import time
import flask import flask
from flask import url_for, g, request from flask import url_for, g, request
from app.models.etudiants import Identite
import app.scodoc.notesdb as ndb import app.scodoc.notesdb as ndb
import app.scodoc.sco_utils as scu import app.scodoc.sco_utils as scu
@ -107,29 +108,57 @@ def formsemestre_validation_etud_form(
if not Se.sem["etat"]: if not Se.sem["etat"]:
raise ScoValueError("validation: semestre verrouille") raise ScoValueError("validation: semestre verrouille")
url_tableau = url_for(
"notes.formsemestre_recapcomplet",
scodoc_dept=g.scodoc_dept,
modejury=1,
formsemestre_id=formsemestre_id,
selected_etudid=etudid, # va a la bonne ligne
)
H = [ H = [
html_sco_header.sco_header( html_sco_header.sco_header(
page_title="Parcours %(nomprenom)s" % etud, page_title=f"Parcours {etud['nomprenom']}",
javascripts=["js/recap_parcours.js"], javascripts=["js/recap_parcours.js"],
) )
] ]
Footer = ["<p>"]
# Navigation suivant/precedent # Navigation suivant/precedent
if etud_index_prev != None: if etud_index_prev is not None:
etud_p = sco_etud.get_etud_info(etudid=T[etud_index_prev][-1], filled=True)[0] etud_prev = Identite.query.get(T[etud_index_prev][-1])
Footer.append( url_prev = url_for(
'<span><a href="formsemestre_validation_etud_form?formsemestre_id=%s&etud_index=%s">Etud. précédent (%s)</a></span>' "notes.formsemestre_validation_etud_form",
% (formsemestre_id, etud_index_prev, etud_p["nomprenom"]) scodoc_dept=g.scodoc_dept,
formsemestre_id=formsemestre_id,
etud_index=etud_index_prev,
) )
if etud_index_next != None: else:
etud_n = sco_etud.get_etud_info(etudid=T[etud_index_next][-1], filled=True)[0] url_prev = None
Footer.append( if etud_index_next is not None:
'<span style="padding-left: 50px;"><a href="formsemestre_validation_etud_form?formsemestre_id=%s&etud_index=%s">Etud. suivant (%s)</a></span>' etud_next = Identite.query.get(T[etud_index_next][-1])
% (formsemestre_id, etud_index_next, etud_n["nomprenom"]) url_next = url_for(
"notes.formsemestre_validation_etud_form",
scodoc_dept=g.scodoc_dept,
formsemestre_id=formsemestre_id,
etud_index=etud_index_next,
) )
Footer.append("</p>") else:
Footer.append(html_sco_header.sco_footer()) url_next = None
footer = ["""<div class="jury_footer"><span>"""]
if url_prev:
footer.append(
f'< <a class="stdlink" href="{url_prev}">{etud_prev.nomprenom}</a>'
)
footer.append(
f"""</span><span><a class="stdlink" href="{url_tableau}">retour à la liste</a></span><span>"""
)
if url_next:
footer.append(
f'<a class="stdlink" href="{url_next}">{etud_next.nomprenom}</a> >'
)
footer.append("</span></div>")
footer.append(html_sco_header.sco_footer())
H.append('<table style="width: 100%"><tr><td>') H.append('<table style="width: 100%"><tr><td>')
if not check: if not check:
@ -171,7 +200,7 @@ def formsemestre_validation_etud_form(
""" """
) )
) )
return "\n".join(H + Footer) return "\n".join(H + footer)
H.append( H.append(
formsemestre_recap_parcours_table( formsemestre_recap_parcours_table(
@ -180,21 +209,10 @@ def formsemestre_validation_etud_form(
) )
if check: if check:
if not desturl: if not desturl:
desturl = url_for( desturl = url_tableau
"notes.formsemestre_recapcomplet",
scodoc_dept=g.scodoc_dept,
modejury=1,
hidemodules=1,
hidebac=1,
pref_override=0,
formsemestre_id=formsemestre_id,
sortcol=sortcol
or None, # pour refaire tri sorttable du tableau de notes
_anchor="etudid%s" % etudid, # va a la bonne ligne
)
H.append(f'<ul><li><a href="{desturl}">Continuer</a></li></ul>') H.append(f'<ul><li><a href="{desturl}">Continuer</a></li></ul>')
return "\n".join(H + Footer) return "\n".join(H + footer)
decision_jury = Se.nt.get_etud_decision_sem(etudid) decision_jury = Se.nt.get_etud_decision_sem(etudid)
@ -210,7 +228,7 @@ def formsemestre_validation_etud_form(
""" """
) )
) )
return "\n".join(H + Footer) return "\n".join(H + footer)
# Infos si pas de semestre précédent # Infos si pas de semestre précédent
if not Se.prev: if not Se.prev:
@ -348,7 +366,7 @@ def formsemestre_validation_etud_form(
else: else:
H.append("sans semestres décalés</p>") H.append("sans semestres décalés</p>")
return "".join(H + Footer) return "".join(H + footer)
def formsemestre_validation_etud( def formsemestre_validation_etud(
@ -437,14 +455,6 @@ def _redirect_valid_choice(formsemestre_id, etudid, Se, choice, desturl, sortcol
# sinon renvoie au listing general, # sinon renvoie au listing general,
# if choice.new_code_prev:
# flask.redirect( 'formsemestre_validation_etud_form?formsemestre_id=%s&etudid=%s&check=1&desturl=%s' % (formsemestre_id, etudid, desturl) )
# else:
# if not desturl:
# desturl = 'formsemestre_recapcomplet?modejury=1&hidemodules=1&formsemestre_id=' + str(formsemestre_id)
# flask.redirect(desturl)
def _dispcode(c): def _dispcode(c):
if not c: if not c:
return "" return ""
@ -948,19 +958,23 @@ def do_formsemestre_validation_auto(formsemestre_id):
) )
if conflicts: if conflicts:
H.append( H.append(
"""<p><b>Attention:</b> %d étudiants non modifiés car décisions différentes f"""<p><b>Attention:</b> {len(conflicts)} étudiants non modifiés
déja saisies :<ul>""" car décisions différentes déja saisies :
% len(conflicts) <ul>"""
) )
for etud in conflicts: for etud in conflicts:
H.append( H.append(
'<li><a href="formsemestre_validation_etud_form?formsemestre_id=%s&etudid=%s&check=1">%s</li>' f"""<li><a href="{
% (formsemestre_id, etud["etudid"], etud["nomprenom"]) url_for('notes.formsemestre_validation_etud_form',
scodoc_dept=g.scodoc_dept, formsemestre_id=formsemestre_id,
etudid=etud["etudid"], check=1)
}">{etud["nomprenom"]}</li>"""
) )
H.append("</ul>") H.append("</ul>")
H.append( H.append(
'<a href="formsemestre_recapcomplet?formsemestre_id=%s&modejury=1&hidemodules=1&hidebac=1&pref_override=0">continuer</a>' f"""<a href="{url_for('notes.formsemestre_recapcomplet',
% formsemestre_id scodoc_dept=g.scodoc_dept, formsemestre_id=formsemestre_id, modejury=1)
}">continuer</a>"""
) )
H.append(html_sco_header.sco_footer()) H.append(html_sco_header.sco_footer())
return "\n".join(H) return "\n".join(H)

View File

@ -698,7 +698,7 @@ def _add_eval_columns(
# calcul moyenne SANS LES ABSENTS ni les DEMISSIONNAIRES # calcul moyenne SANS LES ABSENTS ni les DEMISSIONNAIRES
if ( if (
(etudid in inscrits) (etudid in inscrits)
and val != None and val is not None
and val != scu.NOTES_NEUTRALISE and val != scu.NOTES_NEUTRALISE
and val != scu.NOTES_ATTENTE and val != scu.NOTES_ATTENTE
): ):
@ -721,16 +721,26 @@ def _add_eval_columns(
comment, comment,
) )
else: else:
explanation = "" if (etudid in inscrits) and e["publish_incomplete"]:
val_fmt = "" # Note manquante mais prise en compte immédiate: affiche ATT
val = None val = scu.NOTES_ATTENTE
val_fmt = "ATT"
explanation = "non saisie mais prise en compte immédiate"
else:
explanation = ""
val_fmt = ""
val = None
cell_class = klass + {"ATT": " att", "ABS": " abs", "EXC": " exc"}.get(
val_fmt, ""
)
if val is None: if val is None:
row[f"_{evaluation_id}_td_attrs"] = f'class="etudabs {klass}" ' row[f"_{evaluation_id}_td_attrs"] = f'class="etudabs {cell_class}" '
if not row.get("_css_row_class", ""): if not row.get("_css_row_class", ""):
row["_css_row_class"] = "etudabs" row["_css_row_class"] = "etudabs"
else: else:
row[f"_{evaluation_id}_td_attrs"] = f'class="{klass}" ' row[f"_{evaluation_id}_td_attrs"] = f'class="{cell_class}" '
# regroupe les commentaires # regroupe les commentaires
if explanation: if explanation:
if explanation in K: if explanation in K:

View File

@ -382,18 +382,6 @@ class BasePreferences(object):
"only_global": False, "only_global": False,
}, },
), ),
(
"recap_hidebac",
{
"initvalue": 0,
"title": "Cacher la colonne Bac",
"explanation": "sur la table récapitulative",
"input_type": "boolcheckbox",
"category": "misc",
"labels": ["non", "oui"],
"only_global": False,
},
),
# ------------------ Absences # ------------------ Absences
( (
"email_chefdpt", "email_chefdpt",

File diff suppressed because it is too large Load Diff

View File

@ -55,19 +55,18 @@ from app.scodoc.sco_pdf import SU
from app.scodoc import html_sco_header from app.scodoc import html_sco_header
from app.scodoc import htmlutils from app.scodoc import htmlutils
from app.scodoc import sco_import_etuds from app.scodoc import sco_import_etuds
from app.scodoc import sco_etud
from app.scodoc import sco_excel from app.scodoc import sco_excel
from app.scodoc import sco_formsemestre
from app.scodoc import sco_groups
from app.scodoc import sco_groups_view from app.scodoc import sco_groups_view
from app.scodoc import sco_pdf from app.scodoc import sco_pdf
from app.scodoc import sco_photos from app.scodoc import sco_photos
from app.scodoc import sco_portal_apogee from app.scodoc import sco_portal_apogee
from app.scodoc import sco_preferences from app.scodoc import sco_preferences
from app.scodoc import sco_etud from app.scodoc import sco_trombino_doc
def trombino( def trombino(
group_ids=[], # liste des groupes à afficher group_ids=(), # liste des groupes à afficher
formsemestre_id=None, # utilisé si pas de groupes selectionné formsemestre_id=None, # utilisé si pas de groupes selectionné
etat=None, etat=None,
format="html", format="html",
@ -93,6 +92,8 @@ def trombino(
return _trombino_pdf(groups_infos) return _trombino_pdf(groups_infos)
elif format == "pdflist": elif format == "pdflist":
return _listeappel_photos_pdf(groups_infos) return _listeappel_photos_pdf(groups_infos)
elif format == "doc":
return sco_trombino_doc.trombino_doc(groups_infos)
else: else:
raise Exception("invalid format") raise Exception("invalid format")
# return _trombino_html_header() + trombino_html( group, members) + html_sco_header.sco_footer() # return _trombino_html_header() + trombino_html( group, members) + html_sco_header.sco_footer()
@ -176,8 +177,13 @@ def trombino_html(groups_infos):
H.append("</div>") H.append("</div>")
H.append( H.append(
'<div style="margin-bottom:15px;"><a class="stdlink" href="trombino?format=pdf&%s">Version PDF</a></div>' f"""<div style="margin-bottom:15px;">
% groups_infos.groups_query_args <a class="stdlink" href="{url_for('scolar.trombino', scodoc_dept=g.scodoc_dept,
format='pdf', group_ids=groups_infos.group_ids)}">Version PDF</a>
&nbsp;&nbsp;
<a class="stdlink" href="{url_for('scolar.trombino', scodoc_dept=g.scodoc_dept,
format='doc', group_ids=groups_infos.group_ids)}">Version doc</a>
</div>"""
) )
return "\n".join(H) return "\n".join(H)
@ -234,7 +240,7 @@ def _trombino_zip(groups_infos):
Z.writestr(filename, img) Z.writestr(filename, img)
Z.close() Z.close()
size = data.tell() size = data.tell()
log("trombino_zip: %d bytes" % size) log(f"trombino_zip: {size} bytes")
data.seek(0) data.seek(0)
return send_file( return send_file(
data, data,
@ -470,7 +476,7 @@ def _listeappel_photos_pdf(groups_infos):
# --------------------- Upload des photos de tout un groupe # --------------------- Upload des photos de tout un groupe
def photos_generate_excel_sample(group_ids=[]): def photos_generate_excel_sample(group_ids=()):
"""Feuille excel pour import fichiers photos""" """Feuille excel pour import fichiers photos"""
fmt = sco_import_etuds.sco_import_format() fmt = sco_import_etuds.sco_import_format()
data = sco_import_etuds.sco_import_generate_excel_sample( data = sco_import_etuds.sco_import_generate_excel_sample(
@ -492,31 +498,33 @@ def photos_generate_excel_sample(group_ids=[]):
# return sco_excel.send_excel_file(data, "ImportPhotos" + scu.XLSX_SUFFIX) # return sco_excel.send_excel_file(data, "ImportPhotos" + scu.XLSX_SUFFIX)
def photos_import_files_form(group_ids=[]): def photos_import_files_form(group_ids=()):
"""Formulaire pour importation photos""" """Formulaire pour importation photos"""
if not group_ids: if not group_ids:
raise ScoValueError("paramètre manquant !") raise ScoValueError("paramètre manquant !")
groups_infos = sco_groups_view.DisplayedGroupsInfos(group_ids) groups_infos = sco_groups_view.DisplayedGroupsInfos(group_ids)
back_url = "groups_view?%s&curtab=tab-photos" % groups_infos.groups_query_args back_url = f"groups_view?{groups_infos.groups_query_args}&curtab=tab-photos"
H = [ H = [
html_sco_header.sco_header(page_title="Import des photos des étudiants"), html_sco_header.sco_header(page_title="Import des photos des étudiants"),
"""<h2 class="formsemestre">Téléchargement des photos des étudiants</h2> f"""<h2 class="formsemestre">Téléchargement des photos des étudiants</h2>
<p><b>Vous pouvez aussi charger les photos individuellement via la fiche de chaque étudiant (menu "Etudiant" / "Changer la photo").</b></p> <p><b>Vous pouvez aussi charger les photos individuellement via la fiche
<p class="help">Cette page permet de charger en une seule fois les photos de plusieurs étudiants.<br/> de chaque étudiant (menu "Etudiant" / "Changer la photo").</b>
Il faut d'abord remplir une feuille excel donnant les noms </p>
<p class="help">Cette page permet de charger en une seule fois les photos
de plusieurs étudiants.<br/>
Il faut d'abord remplir une feuille excel donnant les noms
des fichiers images (une image par étudiant). des fichiers images (une image par étudiant).
</p> </p>
<p class="help">Ensuite, réunir vos images dans un fichier zip, puis télécharger <p class="help">Ensuite, réunir vos images dans un fichier zip, puis télécharger
simultanément le fichier excel et le fichier zip. simultanément le fichier excel et le fichier zip.
</p> </p>
<ol> <ol>
<li><a class="stdlink" href="photos_generate_excel_sample?%s"> <li><a class="stdlink" href="photos_generate_excel_sample?{groups_infos.groups_query_args}">
Obtenir la feuille excel à remplir</a> Obtenir la feuille excel à remplir</a>
</li> </li>
<li style="padding-top: 2em;"> <li style="padding-top: 2em;">
""" """,
% groups_infos.groups_query_args,
] ]
F = html_sco_header.sco_footer() F = html_sco_header.sco_footer()
vals = scu.get_request_args() vals = scu.get_request_args()

View File

@ -0,0 +1,76 @@
##############################################################################
# ScoDoc
# Copyright (c) 1999 - 2022 Emmanuel Viennet. All rights reserved.
# See LICENSE
##############################################################################
"""Génération d'un trombinoscope en doc
"""
import docx
from docx.shared import Mm
from docx.enum.text import WD_ALIGN_PARAGRAPH
from docx.enum.table import WD_ALIGN_VERTICAL
from app.scodoc import sco_etud
from app.scodoc import sco_photos
import app.scodoc.sco_utils as scu
import sco_version
def trombino_doc(groups_infos):
"Send photos as docx document"
filename = f"trombino_{groups_infos.groups_filename}.docx"
sem = groups_infos.formsemestre # suppose 1 seul semestre
PHOTO_WIDTH = Mm(25)
N_PER_ROW = 5 # XXX should be in ScoDoc preferences
document = docx.Document()
document.add_heading(
f"Trombinoscope {sem['titreannee']} {groups_infos.groups_titles}", 1
)
section = document.sections[0]
footer = section.footer
footer.paragraphs[
0
].text = f"Généré par {sco_version.SCONAME} le {scu.timedate_human_repr()}"
nb_images = len(groups_infos.members)
table = document.add_table(rows=2 * (nb_images // N_PER_ROW + 1), cols=N_PER_ROW)
table.allow_autofit = False
for i, t in enumerate(groups_infos.members):
li = i // N_PER_ROW
co = i % N_PER_ROW
img_path = (
sco_photos.photo_pathname(t["photo_filename"], size="small")
or sco_photos.UNKNOWN_IMAGE_PATH
)
cell = table.rows[2 * li].cells[co]
cell.vertical_alignment = WD_ALIGN_VERTICAL.TOP
cell_p, cell_f, cell_r = _paragraph_format_run(cell)
cell_r.add_picture(img_path, width=PHOTO_WIDTH)
# le nom de l'étudiant: cellules de lignes impaires
cell = table.rows[2 * li + 1].cells[co]
cell.vertical_alignment = WD_ALIGN_VERTICAL.TOP
cell_p, cell_f, cell_r = _paragraph_format_run(cell)
cell_r.add_text(sco_etud.format_nomprenom(t))
cell_f.space_after = Mm(8)
return scu.send_docx(document, filename)
def _paragraph_format_run(cell):
"parag. dans cellule tableau"
# inspired by https://stackoverflow.com/questions/64218305/problem-with-python-docx-putting-pictures-in-a-table
paragraph = cell.paragraphs[0]
fmt = paragraph.paragraph_format
run = paragraph.add_run()
fmt.space_before = Mm(0)
fmt.space_after = Mm(0)
fmt.line_spacing = 1.0
fmt.alignment = WD_ALIGN_PARAGRAPH.CENTER
return paragraph, fmt, run

View File

@ -33,6 +33,7 @@ import bisect
import copy import copy
import datetime import datetime
from enum import IntEnum from enum import IntEnum
import io
import json import json
from hashlib import md5 from hashlib import md5
import numbers import numbers
@ -49,6 +50,7 @@ from PIL import Image as PILImage
import pydot import pydot
import requests import requests
import flask
from flask import g, request from flask import g, request
from flask import flash, url_for, make_response, jsonify from flask import flash, url_for, make_response, jsonify
@ -176,6 +178,7 @@ MONTH_NAMES = (
"novembre", "novembre",
"décembre", "décembre",
) )
DAY_NAMES = ("lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi", "dimanche")
def fmt_note(val, note_max=None, keep_numeric=False): def fmt_note(val, note_max=None, keep_numeric=False):
@ -379,6 +382,10 @@ CSV_FIELDSEP = ";"
CSV_LINESEP = "\n" CSV_LINESEP = "\n"
CSV_MIMETYPE = "text/comma-separated-values" CSV_MIMETYPE = "text/comma-separated-values"
CSV_SUFFIX = ".csv" CSV_SUFFIX = ".csv"
DOCX_MIMETYPE = (
"application/vnd.openxmlformats-officedocument.wordprocessingml.document"
)
DOCX_SUFFIX = ".docx"
JSON_MIMETYPE = "application/json" JSON_MIMETYPE = "application/json"
JSON_SUFFIX = ".json" JSON_SUFFIX = ".json"
PDF_MIMETYPE = "application/pdf" PDF_MIMETYPE = "application/pdf"
@ -398,6 +405,7 @@ def get_mime_suffix(format_code: str) -> tuple[str, str]:
""" """
d = { d = {
"csv": (CSV_MIMETYPE, CSV_SUFFIX), "csv": (CSV_MIMETYPE, CSV_SUFFIX),
"docx": (DOCX_MIMETYPE, DOCX_SUFFIX),
"xls": (XLSX_MIMETYPE, XLSX_SUFFIX), "xls": (XLSX_MIMETYPE, XLSX_SUFFIX),
"xlsx": (XLSX_MIMETYPE, XLSX_SUFFIX), "xlsx": (XLSX_MIMETYPE, XLSX_SUFFIX),
"pdf": (PDF_MIMETYPE, PDF_SUFFIX), "pdf": (PDF_MIMETYPE, PDF_SUFFIX),
@ -740,6 +748,18 @@ def send_file(data, filename="", suffix="", mime=None, attached=None):
return response return response
def send_docx(document, filename):
"Send a python-docx document"
buffer = io.BytesIO() # in-memory document, no disk file
document.save(buffer)
buffer.seek(0)
return flask.send_file(
buffer,
attachment_filename=sanitize_filename(filename),
mimetype=DOCX_MIMETYPE,
)
def get_request_args(): def get_request_args():
"""returns a dict with request (POST or GET) arguments """returns a dict with request (POST or GET) arguments
converted to suit legacy Zope style (scodoc7) functions. converted to suit legacy Zope style (scodoc7) functions.
@ -1057,6 +1077,36 @@ def objects_renumber(db, obj_list) -> None:
db.session.commit() db.session.commit()
def gen_cell(key: str, row: dict, elt="td", with_col_class=False):
"html table cell"
klass = row.get(f"_{key}_class", "")
if with_col_class:
klass = key + " " + klass
attrs = f'class="{klass}"' if klass else ""
order = row.get(f"_{key}_order")
if order:
attrs += f' data-order="{order}"'
content = row.get(key, "")
target = row.get(f"_{key}_target")
target_attrs = row.get(f"_{key}_target_attrs", "")
if target or target_attrs: # avec lien
href = f'href="{target}"' if target else ""
content = f"<a {href} {target_attrs}>{content}</a>"
return f"<{elt} {attrs}>{content}</{elt}>"
def gen_row(
keys: list[str], row, elt="td", selected_etudid=None, with_col_classes=False
):
"html table row"
klass = row.get("_tr_class")
tr_class = f'class="{klass}"' if klass else ""
tr_id = (
f"""id="row_selected" """ if (row.get("etudid", "") == selected_etudid) else ""
)
return f"""<tr {tr_id} {tr_class}>{"".join([gen_cell(key, row, elt, with_col_class=with_col_classes) for key in keys if not key.startswith('_')])}</tr>"""
# Pour accès depuis les templates jinja # Pour accès depuis les templates jinja
def is_entreprises_enabled(): def is_entreprises_enabled():
from app.models import ScoDocSiteConfig from app.models import ScoDocSiteConfig

View File

@ -1076,7 +1076,7 @@ tr.etuddem td {
td.etudabs, td.etudabs,
td.etudabs a.discretelink, td.etudabs a.discretelink,
tr.etudabs td.moyenne a.discretelink { tr.etudabs td.moyenne a.discretelink {
color: rgb(180, 0, 0); color: rgb(195, 0, 0);
} }
tr.moyenne td { tr.moyenne td {
@ -1103,6 +1103,17 @@ table.notes_evaluation th.eval_attente {
width: 80px; width: 80px;
} }
table.notes_evaluation td.att a {
color: rgb(255, 0, 217);
font-weight: bold;
}
table.notes_evaluation td.exc a {
font-style: italic;
color: rgb(0, 131, 0);
}
table.notes_evaluation tr td a.discretelink:hover { table.notes_evaluation tr td a.discretelink:hover {
text-decoration: none; text-decoration: none;
} }
@ -1146,6 +1157,18 @@ span.jurylink a {
text-decoration: underline; text-decoration: underline;
} }
div.jury_footer {
display: flex;
justify-content: space-evenly;
}
div.jury_footer>span {
border: 2px solid rgb(90, 90, 90);
border-radius: 4px;
padding: 4px;
background-color: rgb(230, 242, 230);
}
.eval_description p { .eval_description p {
margin-left: 15px; margin-left: 15px;
margin-bottom: 2px; margin-bottom: 2px;
@ -3542,7 +3565,7 @@ table.dataTable td.group {
text-align: left; text-align: left;
} }
/* Nouveau tableau recap */ /* ------------- Nouveau tableau recap ------------ */
div.table_recap { div.table_recap {
margin-top: 6px; margin-top: 6px;
} }
@ -3718,6 +3741,15 @@ table.table_recap tr.descr_evaluation {
color: rgb(4, 16, 159); color: rgb(4, 16, 159);
} }
table.table_recap tr.descr_evaluation a {
color: rgb(4, 16, 159);
text-decoration: none;
}
table.table_recap tr.descr_evaluation a:hover {
color: red;
}
table.table_recap tr.descr_evaluation { table.table_recap tr.descr_evaluation {
vertical-align: top; vertical-align: top;
} }
@ -3735,4 +3767,78 @@ table.table_recap tr.apo td {
table.table_recap td.evaluation.first, table.table_recap td.evaluation.first,
table.table_recap th.evaluation.first { table.table_recap th.evaluation.first {
border-left: 2px solid rgb(4, 16, 159); border-left: 2px solid rgb(4, 16, 159);
}
table.table_recap td.evaluation.first_of_mod,
table.table_recap th.evaluation.first_of_mod {
border-left: 1px dashed rgb(4, 16, 159);
}
table.table_recap td.evaluation.att {
color: rgb(255, 0, 217);
font-weight: bold;
}
table.table_recap td.evaluation.abs {
color: rgb(231, 0, 0);
font-weight: bold;
}
table.table_recap td.evaluation.exc {
font-style: italic;
color: rgb(0, 131, 0);
}
table.table_recap td.evaluation.non_inscrit {
font-style: italic;
color: rgb(101, 101, 101);
}
/* ------------- Tableau etat evals ------------ */
div.evaluations_recap table.evaluations_recap {
width: auto !important;
border: 1px solid black;
}
table.evaluations_recap tr.odd td {
background-color: #fff4e4;
}
table.evaluations_recap tr.res td {
background-color: #f7d372;
}
table.evaluations_recap tr.sae td {
background-color: #d8fcc8;
}
table.evaluations_recap tr.module td {
font-weight: bold;
}
table.evaluations_recap tr.evaluation td.titre {
font-style: italic;
padding-left: 2em;
}
table.evaluations_recap td.titre,
table.evaluations_recap th.titre {
max-width: 350px;
}
table.evaluations_recap td.complete,
table.evaluations_recap th.complete {
text-align: center;
}
table.evaluations_recap tr.evaluation.incomplete td,
table.evaluations_recap tr.evaluation.incomplete td a {
color: red;
}
table.evaluations_recap tr.evaluation.incomplete td a.incomplete {
font-weight: bold;
} }

View File

@ -0,0 +1,38 @@
// Tableau recap evaluations du semestre
$(function () {
$('table.evaluations_recap').DataTable(
{
paging: false,
searching: true,
info: false,
autoWidth: false,
fixedHeader: {
header: true,
footer: false
},
orderCellsTop: true, // cellules ligne 1 pour tri
aaSorting: [], // Prevent initial sorting
colReorder: true,
"columnDefs": [
{
// colonne date, triable (XXX ne fonctionne pas)
targets: ["date"],
"type": "string",
},
],
dom: 'Bfrtip',
buttons: [
{
extend: 'copyHtml5',
text: 'Copier',
exportOptions: { orthogonal: 'export' }
},
{
extend: 'excelHtml5',
exportOptions: { orthogonal: 'export' },
title: document.querySelector('table.evaluations_recap').dataset.filename
},
],
})
});

View File

@ -3,14 +3,14 @@
$(function () { $(function () {
// Autocomplete recherche etudiants par nom // Autocomplete recherche etudiants par nom
$("#in-expnom").autocomplete( $(".in-expnom").autocomplete(
{ {
delay: 300, // wait 300ms before suggestions delay: 300, // wait 300ms before suggestions
minLength: 2, // min nb of chars before suggest minLength: 2, // min nb of chars before suggest
position: { collision: 'flip' }, // automatic menu position up/down position: { collision: 'flip' }, // automatic menu position up/down
source: "search_etud_by_name", source: SCO_URL + "/search_etud_by_name",
select: function (event, ui) { select: function (event, ui) {
$("#in-expnom").val(ui.item.value); $(".in-expnom").val(ui.item.value);
$("#form-chercheetud").submit(); $("#form-chercheetud").submit();
} }
}); });

View File

@ -21,43 +21,54 @@ $(function () {
dt.columns(".partition_aux").visible(!visible); dt.columns(".partition_aux").visible(!visible);
dt.buttons('toggle_partitions:name').text(visible ? "Toutes les partitions" : "Cacher les partitions"); dt.buttons('toggle_partitions:name').text(visible ? "Toutes les partitions" : "Cacher les partitions");
} }
}, }];
$('table.table_recap').hasClass("apc") ? if (!$('table.table_recap').hasClass("jury")) {
{ buttons.push(
name: "toggle_res", $('table.table_recap').hasClass("apc") ?
text: "Cacher les ressources", {
action: function (e, dt, node, config) { name: "toggle_res",
let visible = dt.columns(".col_res").visible()[0]; text: "Cacher les ressources",
dt.columns(".col_res").visible(!visible); action: function (e, dt, node, config) {
dt.columns(".col_ue_bonus").visible(!visible); let visible = dt.columns(".col_res").visible()[0];
dt.columns(".col_malus").visible(!visible); dt.columns(".col_res").visible(!visible);
dt.buttons('toggle_res:name').text(visible ? "Montrer les ressources" : "Cacher les ressources"); dt.columns(".col_ue_bonus").visible(!visible);
dt.columns(".col_malus").visible(!visible);
dt.buttons('toggle_res:name').text(visible ? "Montrer les ressources" : "Cacher les ressources");
}
} : {
name: "toggle_mod",
text: "Cacher les modules",
action: function (e, dt, node, config) {
let visible = dt.columns(".col_mod:not(.col_empty)").visible()[0];
dt.columns(".col_mod:not(.col_empty)").visible(!visible);
dt.columns(".col_ue_bonus").visible(!visible);
dt.columns(".col_malus").visible(!visible);
dt.buttons('toggle_mod:name').text(visible ? "Montrer les modules" : "Cacher les modules");
visible = dt.columns(".col_empty").visible()[0];
dt.buttons('toggle_col_empty:name').text(visible ? "Cacher mod. vides" : "Montrer mod. vides");
}
} }
} : { );
name: "toggle_mod", if ($('table.table_recap').hasClass("apc")) {
text: "Cacher les modules", buttons.push({
name: "toggle_sae",
text: "Cacher les SAÉs",
action: function (e, dt, node, config) { action: function (e, dt, node, config) {
let visible = dt.columns(".col_mod:not(.col_empty)").visible()[0]; let visible = dt.columns(".col_sae").visible()[0];
dt.columns(".col_mod:not(.col_empty)").visible(!visible); dt.columns(".col_sae").visible(!visible);
dt.columns(".col_ue_bonus").visible(!visible); dt.buttons('toggle_sae:name').text(visible ? "Montrer les SAÉs" : "Cacher les SAÉs");
dt.columns(".col_malus").visible(!visible);
dt.buttons('toggle_mod:name').text(visible ? "Montrer les modules" : "Cacher les modules");
visible = dt.columns(".col_empty").visible()[0];
dt.buttons('toggle_col_empty:name').text(visible ? "Cacher mod. vides" : "Montrer mod. vides");
} }
} })
]; }
if ($('table.table_recap').hasClass("apc")) {
buttons.push({ buttons.push({
name: "toggle_sae", name: "toggle_col_empty",
text: "Cacher les SAÉs", text: "Montrer mod. vides",
action: function (e, dt, node, config) { action: function (e, dt, node, config) {
let visible = dt.columns(".col_sae").visible()[0]; let visible = dt.columns(".col_empty").visible()[0];
dt.columns(".col_sae").visible(!visible); dt.columns(".col_empty").visible(!visible);
dt.buttons('toggle_sae:name').text(visible ? "Montrer les SAÉs" : "Cacher les SAÉs"); dt.buttons('toggle_col_empty:name').text(visible ? "Montrer mod. vides" : "Cacher mod. vides");
} }
}) })
} }
buttons.push({ buttons.push({
name: "toggle_admission", name: "toggle_admission",
@ -68,15 +79,6 @@ $(function () {
dt.buttons('toggle_admission:name').text(visible ? "Montrer infos admission" : "Cacher infos admission"); dt.buttons('toggle_admission:name').text(visible ? "Montrer infos admission" : "Cacher infos admission");
} }
}) })
buttons.push({
name: "toggle_col_empty",
text: "Montrer mod. vides",
action: function (e, dt, node, config) {
let visible = dt.columns(".col_empty").visible()[0];
dt.columns(".col_empty").visible(!visible);
dt.buttons('toggle_col_empty:name').text(visible ? "Montrer mod. vides" : "Cacher mod. vides");
}
})
$('table.table_recap').DataTable( $('table.table_recap').DataTable(
{ {
paging: false, paging: false,
@ -143,4 +145,10 @@ $(function () {
$(this).addClass('selected'); $(this).addClass('selected');
} }
}); });
// Pour montrer et highlihter l'étudiant sélectionné:
$(function () {
document.querySelector("#row_selected").scrollIntoView();
window.scrollBy(0, -50);
document.querySelector("#row_selected").classList.add("selected");
});
}); });

View File

@ -32,7 +32,7 @@
{% if can_edit_appreciations %} {% if can_edit_appreciations %}
<p><a class="stdlink" href="{{url_for( <p><a class="stdlink" href="{{url_for(
'notes.appreciation_add_form', scodoc_dept=g.scodoc_dept, 'notes.appreciation_add_form', scodoc_dept=g.scodoc_dept,
etudid=etud.id, formsemestre_id=formsemestre_id) etudid=etud.id, formsemestre_id=formsemestre.id)
}}">Ajouter une appréciation</a> }}">Ajouter une appréciation</a>
</p> </p>
{% endif %} {% endif %}

View File

@ -15,7 +15,7 @@
<h2 class="insidebar">Dépt. {{ sco.prefs["DeptName"] }}</h2> <h2 class="insidebar">Dépt. {{ sco.prefs["DeptName"] }}</h2>
<a href="{{ url_for('scolar.index_html', scodoc_dept=g.scodoc_dept) }}" class="sidebar">Accueil</a> <br /> <a href="{{ url_for('scolar.index_html', scodoc_dept=g.scodoc_dept) }}" class="sidebar">Accueil</a> <br />
{% if sco.prefs["DeptIntranetURL"] %} {% if sco.prefs["DeptIntranetURL"] %}
<a href="{{ sco.prefs["DeptIntranetURL"] }}" class="sidebar"> <a href="{{ sco.prefs[" DeptIntranetURL"] }}" class="sidebar">
{{ sco.prefs["DeptIntranetTitle"] }}</a> {{ sco.prefs["DeptIntranetTitle"] }}</a>
{% endif %} {% endif %}
<br> <br>
@ -41,7 +41,7 @@
<form method="get" id="form-chercheetud" <form method="get" id="form-chercheetud"
action="{{ url_for('scolar.search_etud_in_dept', scodoc_dept=g.scodoc_dept) }}"> action="{{ url_for('scolar.search_etud_in_dept', scodoc_dept=g.scodoc_dept) }}">
<div> <div>
<input type="text" size="12" id="in-expnom" name="expnom" spellcheck="false" /> <input type="text" size="12" class="in-expnom" name="expnom" spellcheck="false" />
</div> </div>
</form> </form>
</div> </div>
@ -49,7 +49,7 @@
<div class="etud-insidebar"> <div class="etud-insidebar">
{% if sco.etud %} {% if sco.etud %}
<h2 id="insidebar-etud"><a href="{{url_for( <h2 id="insidebar-etud"><a href="{{url_for(
"scolar.ficheEtud", scodoc_dept=g.scodoc_dept, etudid=sco.etud.id )}}" class="sidebar"> 'scolar.ficheEtud', scodoc_dept=g.scodoc_dept, etudid=sco.etud.id )}}" class="sidebar">
<span class="fontred">{{sco.etud.nomprenom}}</span></a> <span class="fontred">{{sco.etud.nomprenom}}</span></a>
</h2> </h2>
<b>Absences</b> <b>Absences</b>

View File

@ -69,7 +69,7 @@ from app.decorators import (
permission_required, permission_required,
permission_required_compat_scodoc7, permission_required_compat_scodoc7,
) )
from app.models import FormSemestre from app.models import FormSemestre, GroupDescr
from app.models.absences import BilletAbsence from app.models.absences import BilletAbsence
from app.views import absences_bp as bp from app.views import absences_bp as bp
@ -119,63 +119,71 @@ def sco_publish(route, function, permission, methods=["GET"]):
@scodoc7func @scodoc7func
def index_html(): def index_html():
"""Gestionnaire absences, page principale""" """Gestionnaire absences, page principale"""
# crude portage from 1999 DTML
sems = sco_formsemestre.do_formsemestre_list()
authuser = current_user
H = [ H = [
html_sco_header.sco_header( html_sco_header.sco_header(
page_title="Gestion des absences", page_title="Saisie des absences",
cssstyles=["css/calabs.css"], cssstyles=["css/calabs.css"],
javascripts=["js/calabs.js"], javascripts=["js/calabs.js"],
), ),
"""<h2>Gestion des Absences</h2>""", """<h2>Traitement des absences</h2>
<p class="help">
Pour saisir des absences ou consulter les états, il est recommandé par passer par
le semestre concerné (saisie par jours nommés ou par semaines).
</p>
""",
] ]
if not sems: H.append(
"""<p class="help">Pour signaler, annuler ou justifier une absence pour un seul étudiant,
choisissez d'abord concerné:</p>"""
)
H.append(sco_find_etud.form_search_etud())
if current_user.has_permission(
Permission.ScoAbsChange
) and sco_preferences.get_preference("handle_billets_abs"):
H.append( H.append(
"""<p class="warning">Aucun semestre défini (ou aucun groupe d'étudiant)</p>"""
)
else:
H.append(
"""<ul><li><a href="EtatAbsences">Afficher l'état des absences (pour tout un groupe)</a></li>"""
)
if sco_preferences.get_preference("handle_billets_abs"):
H.append(
"""<li><a href="listeBillets">Traitement des billets d'absence en attente</a></li>"""
)
H.append(
"""<p>Pour signaler, annuler ou justifier une absence, choisissez d'abord l'étudiant concerné:</p>"""
)
H.append(sco_find_etud.form_search_etud())
if authuser.has_permission(Permission.ScoAbsChange):
H.extend(
(
"""<hr/>
<form action="SignaleAbsenceGrHebdo" id="formw">
<input type="hidden" name="destination" value="%s"/>
<p>
<span style="font-weight: bold; font-size:120%%;">
Saisie par semaine </span> - Choix du groupe:
<input name="datelundi" type="hidden" value="x"/>
""" """
% request.base_url, <h2 style="margin-top: 30px;">Billets d'absence</h2>
sco_abs_views.formChoixSemestreGroupe(), <ul><li><a href="listeBillets">Traitement des billets d'absence en attente</a></li></ul>
"</p>", """
cal_select_week(), )
"""<p class="help">Sélectionner le groupe d'étudiants, puis cliquez sur une semaine pour
saisir les absences de toute cette semaine.</p>
</form>""",
)
)
else:
H.append(
"""<p class="scoinfo">Vous n'avez pas l'autorisation d'ajouter, justifier ou supprimer des absences.</p>"""
)
H.append(html_sco_header.sco_footer()) H.append(html_sco_header.sco_footer())
return "\n".join(H) return "\n".join(H)
@bp.route("/choix_semaine")
@scodoc
@permission_required(Permission.ScoAbsChange)
@scodoc7func
def choix_semaine(group_id):
"""Page choix semaine sur calendrier pour saisie absences d'un groupe"""
group = GroupDescr.query.get_or_404(group_id)
H = [
html_sco_header.sco_header(
page_title="Saisie des absences",
cssstyles=["css/calabs.css"],
javascripts=["js/calabs.js"],
),
f"""
<h2>Saisie des Absences</h2>
<form action="SignaleAbsenceGrHebdo" id="formw">
<p>
<span style="font-weight: bold; font-size:120%;">
Saisie par semaine </span> - Groupe: {group.get_nom_with_part()}
<input name="datelundi" type="hidden" value="x"/>
<input name="group_ids" type="hidden" value="{group_id}"/>
</p>
""",
cal_select_week(),
"""<p class="help">Sélectionner le groupe d'étudiants, puis cliquez sur une semaine pour
saisir les absences de toute cette semaine.</p>
</form>
""",
html_sco_header.sco_footer(),
]
return "\n".join(H)
def cal_select_week(year=None): def cal_select_week(year=None):
"display calendar allowing week selection" "display calendar allowing week selection"
if not year: if not year:
@ -479,7 +487,7 @@ def SignaleAbsenceGrSemestre(
datedebut, datedebut,
datefin, datefin,
destination="", destination="",
group_ids=[], # list of groups to display group_ids=(), # list of groups to display
nbweeks=4, # ne montre que les nbweeks dernieres semaines nbweeks=4, # ne montre que les nbweeks dernieres semaines
moduleimpl_id=None, moduleimpl_id=None,
): ):
@ -566,7 +574,7 @@ def SignaleAbsenceGrSemestre(
url_link_semaines += "&moduleimpl_id=" + str(moduleimpl_id) url_link_semaines += "&moduleimpl_id=" + str(moduleimpl_id)
# #
dates = [x.ISO() for x in dates] dates = [x.ISO() for x in dates]
dayname = sco_abs.day_names()[jourdebut.weekday] day_name = sco_abs.day_names()[jourdebut.weekday]
if groups_infos.tous_les_etuds_du_sem: if groups_infos.tous_les_etuds_du_sem:
gr_tit = "en" gr_tit = "en"
@ -579,19 +587,18 @@ def SignaleAbsenceGrSemestre(
H = [ H = [
html_sco_header.sco_header( html_sco_header.sco_header(
page_title="Saisie des absences", page_title=f"Saisie des absences du {day_name}",
init_qtip=True, init_qtip=True,
javascripts=["js/etud_info.js", "js/abs_ajax.js"], javascripts=["js/etud_info.js", "js/abs_ajax.js"],
no_side_bar=1, no_side_bar=1,
), ),
"""<table border="0" cellspacing="16"><tr><td> f"""<table border="0" cellspacing="16"><tr><td>
<h2>Saisie des absences %s %s, <h2>Saisie des absences {gr_tit} {sem["titre_num"]},
les <span class="fontred">%s</span></h2> les <span class="fontred">{day_name}s</span></h2>
<p> <p>
<a href="%s">%s</a> <a href="{url_link_semaines}">{msg}</a>
<form id="abs_form" action="doSignaleAbsenceGrSemestre" method="post"> <form id="abs_form" action="doSignaleAbsenceGrSemestre" method="post">
""" """,
% (gr_tit, sem["titre_num"], dayname, url_link_semaines, msg),
] ]
# #
if etuds: if etuds:
@ -820,7 +827,6 @@ def _gen_form_saisie_groupe(
# version pour formulaire avec AJAX (Yann LB) # version pour formulaire avec AJAX (Yann LB)
H.append( H.append(
""" """
<p><input type="button" value="Retour" onClick="window.location='%s'"/>
</p> </p>
</form> </form>
</p> </p>
@ -831,8 +837,7 @@ def _gen_form_saisie_groupe(
</p><p class="help">Si vous "décochez" une case, l'absence correspondante sera supprimée. </p><p class="help">Si vous "décochez" une case, l'absence correspondante sera supprimée.
Attention, les modifications sont automatiquement entregistrées au fur et à mesure. Attention, les modifications sont automatiquement entregistrées au fur et à mesure.
</p> </p>
""" """
% destination
) )
return H return H

View File

@ -100,6 +100,7 @@ from app.scodoc import sco_evaluations
from app.scodoc import sco_evaluation_check_abs from app.scodoc import sco_evaluation_check_abs
from app.scodoc import sco_evaluation_db from app.scodoc import sco_evaluation_db
from app.scodoc import sco_evaluation_edit from app.scodoc import sco_evaluation_edit
from app.scodoc import sco_evaluation_recap
from app.scodoc import sco_export_results from app.scodoc import sco_export_results
from app.scodoc import sco_formations from app.scodoc import sco_formations
from app.scodoc import sco_formsemestre from app.scodoc import sco_formsemestre
@ -109,22 +110,18 @@ from app.scodoc import sco_formsemestre_exterieurs
from app.scodoc import sco_formsemestre_inscriptions from app.scodoc import sco_formsemestre_inscriptions
from app.scodoc import sco_formsemestre_status from app.scodoc import sco_formsemestre_status
from app.scodoc import sco_formsemestre_validation from app.scodoc import sco_formsemestre_validation
from app.scodoc import sco_groups
from app.scodoc import sco_inscr_passage from app.scodoc import sco_inscr_passage
from app.scodoc import sco_liste_notes from app.scodoc import sco_liste_notes
from app.scodoc import sco_lycee from app.scodoc import sco_lycee
from app.scodoc import sco_moduleimpl from app.scodoc import sco_moduleimpl
from app.scodoc import sco_moduleimpl_inscriptions from app.scodoc import sco_moduleimpl_inscriptions
from app.scodoc import sco_moduleimpl_status from app.scodoc import sco_moduleimpl_status
from app.scodoc import sco_news
from app.scodoc import sco_parcours_dut
from app.scodoc import sco_permissions_check from app.scodoc import sco_permissions_check
from app.scodoc import sco_placement from app.scodoc import sco_placement
from app.scodoc import sco_poursuite_dut from app.scodoc import sco_poursuite_dut
from app.scodoc import sco_preferences from app.scodoc import sco_preferences
from app.scodoc import sco_prepajury from app.scodoc import sco_prepajury
from app.scodoc import sco_pvjury from app.scodoc import sco_pvjury
from app.scodoc import sco_pvpdf
from app.scodoc import sco_recapcomplet from app.scodoc import sco_recapcomplet
from app.scodoc import sco_report from app.scodoc import sco_report
from app.scodoc import sco_saisie_notes from app.scodoc import sco_saisie_notes
@ -136,7 +133,6 @@ from app.scodoc import sco_undo_notes
from app.scodoc import sco_users from app.scodoc import sco_users
from app.scodoc import sco_xml from app.scodoc import sco_xml
from app.scodoc.gen_tables import GenTable from app.scodoc.gen_tables import GenTable
from app.scodoc.sco_pdf import PDFLOCK
from app.scodoc.sco_permissions import Permission from app.scodoc.sco_permissions import Permission
from app.scodoc.TrivialFormulator import TrivialFormulator from app.scodoc.TrivialFormulator import TrivialFormulator
from app.views import ScoData from app.views import ScoData
@ -235,6 +231,11 @@ sco_publish(
sco_recapcomplet.formsemestre_recapcomplet, sco_recapcomplet.formsemestre_recapcomplet,
Permission.ScoView, Permission.ScoView,
) )
sco_publish(
"/evaluations_recap",
sco_evaluation_recap.evaluations_recap,
Permission.ScoView,
)
sco_publish( sco_publish(
"/formsemestres_bulletins", "/formsemestres_bulletins",
sco_recapcomplet.formsemestres_bulletins, sco_recapcomplet.formsemestres_bulletins,

View File

@ -1,7 +1,7 @@
# -*- mode: python -*- # -*- mode: python -*-
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
SCOVERSION = "9.1.91" SCOVERSION = "9.2.0a"
SCONAME = "ScoDoc" SCONAME = "ScoDoc"