forked from ScoDoc/ScoDoc
Recap BUT: ajoute groupe + fix sort rang
This commit is contained in:
parent
13f55d5190
commit
5a71c406fb
@ -18,7 +18,9 @@ from app.models import ScoDocSiteConfig
|
||||
from app.models.etudiants import Identite
|
||||
from app.models.moduleimpls import ModuleImpl
|
||||
from app.models.ues import UniteEns
|
||||
from app.scodoc import sco_groups
|
||||
from app.scodoc import sco_preferences
|
||||
from app.scodoc import sco_codes_parcours
|
||||
from app.scodoc.sco_codes_parcours import UE_SPORT
|
||||
import app.scodoc.sco_utils as scu
|
||||
|
||||
@ -233,6 +235,7 @@ class ResultatsSemestreBUT(NotesTableCompat):
|
||||
add_cell(row, "nom_disp", "Nom", etud.nom_disp(), "identite_detail")
|
||||
add_cell(row, "prenom", "Prénom", etud.prenom, "identite_detail")
|
||||
add_cell(row, "nom_short", "Nom", etud.nom_short, "identite_court")
|
||||
self._recap_etud_groups_infos(etudid, row, titles)
|
||||
# --- Moyenne générale
|
||||
moy_gen = self.etud_moy_gen.get(etudid, False)
|
||||
note_class = ""
|
||||
@ -303,7 +306,7 @@ class ResultatsSemestreBUT(NotesTableCompat):
|
||||
rows.sort(key=lambda e: e["_rang_order"])
|
||||
|
||||
# INFOS POUR FOOTER
|
||||
bottom_infos = self._bottom_infos(
|
||||
bottom_infos = self._recap_bottom_infos(
|
||||
[ue for ue in ues if ue.type != UE_SPORT], modimpl_ids, fmt_note
|
||||
)
|
||||
|
||||
@ -315,7 +318,7 @@ class ResultatsSemestreBUT(NotesTableCompat):
|
||||
row["moy_gen"] = row.get("moy_gen", "")
|
||||
row["_moy_gen_class"] = "col_moy_gen"
|
||||
# titre de la ligne:
|
||||
row["nom_disp"] = row["nom_short"] = bottom_line.capitalize()
|
||||
row["prenom"] = row["nom_short"] = bottom_line.capitalize()
|
||||
row["_tr_class"] = bottom_line.lower()
|
||||
footer_rows.append(row)
|
||||
return (
|
||||
@ -325,7 +328,7 @@ class ResultatsSemestreBUT(NotesTableCompat):
|
||||
[title for title in titles if not title.startswith("_")],
|
||||
)
|
||||
|
||||
def _bottom_infos(self, ues, modimpl_ids: set, fmt_note) -> dict:
|
||||
def _recap_bottom_infos(self, ues, modimpl_ids: set, fmt_note) -> dict:
|
||||
"""Les informations à mettre en bas de la table: min, max, moy, ECTS"""
|
||||
bottom_infos = { # { key : row } avec key = min, max, moy, coef
|
||||
"min": {},
|
||||
@ -376,3 +379,28 @@ class ResultatsSemestreBUT(NotesTableCompat):
|
||||
bottom_infos["max"] = row_max
|
||||
bottom_infos["moy"] = row_moy
|
||||
return bottom_infos
|
||||
|
||||
def _recap_etud_groups_infos(self, etudid: int, row: dict, titles: dict):
|
||||
"""Ajoute à row les colonnes sur les groupes pour etud"""
|
||||
# XXX à remonter dans res_common
|
||||
# dec = self.get_etud_decision_sem(etudid)
|
||||
# if dec:
|
||||
# codes_nb[dec["code"]] += 1
|
||||
row_class = ""
|
||||
etud_etat = self.get_etud_etat(etudid)
|
||||
if etud_etat == sco_codes_parcours.DEM:
|
||||
gr_name = "Dém."
|
||||
row_class = "dem"
|
||||
elif etud_etat == sco_codes_parcours.DEF:
|
||||
gr_name = "Déf."
|
||||
row_class = "def"
|
||||
else:
|
||||
# XXX probablement à revoir pour utiliser données cachées,
|
||||
# via get_etud_groups_in_partition ou autre
|
||||
group = sco_groups.get_etud_main_group(etudid, self.formsemestre.id)
|
||||
gr_name = group["group_name"] or ""
|
||||
row["group"] = gr_name
|
||||
row["_group_class"] = "group"
|
||||
if row_class:
|
||||
row["_tr_class"] = " ".join([row.get("_tr_class", ""), row_class])
|
||||
titles["group"] = "Gr"
|
||||
|
@ -343,7 +343,7 @@ def get_group_other_partitions(group):
|
||||
return other_partitions
|
||||
|
||||
|
||||
def get_etud_groups(etudid, sem, exclude_default=False):
|
||||
def get_etud_groups(etudid: int, formsemestre_id: int, exclude_default=False):
|
||||
"""Infos sur groupes de l'etudiant dans ce semestre
|
||||
[ group + partition_name ]
|
||||
"""
|
||||
@ -358,18 +358,18 @@ def get_etud_groups(etudid, sem, exclude_default=False):
|
||||
req += " and p.partition_name is not NULL"
|
||||
groups = ndb.SimpleDictFetch(
|
||||
req + " ORDER BY p.numero",
|
||||
{"etudid": etudid, "formsemestre_id": sem["formsemestre_id"]},
|
||||
{"etudid": etudid, "formsemestre_id": formsemestre_id},
|
||||
)
|
||||
return _sortgroups(groups)
|
||||
|
||||
|
||||
def get_etud_main_group(etudid, sem):
|
||||
def get_etud_main_group(etudid: int, formsemestre_id: int):
|
||||
"""Return main group (the first one) for etud, or default one if no groups"""
|
||||
groups = get_etud_groups(etudid, sem, exclude_default=True)
|
||||
groups = get_etud_groups(etudid, formsemestre_id, exclude_default=True)
|
||||
if groups:
|
||||
return groups[0]
|
||||
else:
|
||||
return get_group(get_default_group(sem["formsemestre_id"]))
|
||||
return get_group(get_default_group(formsemestre_id))
|
||||
|
||||
|
||||
def formsemestre_get_main_partition(formsemestre_id):
|
||||
|
@ -323,7 +323,7 @@ def _make_table_notes(
|
||||
etud = sco_etud.get_etud_info(etudid=etudid, filled=True)[0]
|
||||
|
||||
if etat == "I": # si inscrit, indique groupe
|
||||
groups = sco_groups.get_etud_groups(etudid, sem)
|
||||
groups = sco_groups.get_etud_groups(etudid, modimpl_o["formsemestre_id"])
|
||||
grc = sco_groups.listgroups_abbrev(groups)
|
||||
else:
|
||||
if etat == "D":
|
||||
|
@ -192,7 +192,7 @@ def moduleimpl_inscriptions_edit(moduleimpl_id, etuds=[], submitted=False):
|
||||
)
|
||||
H.append("""</input></td>""")
|
||||
|
||||
groups = sco_groups.get_etud_groups(etud["etudid"], sem)
|
||||
groups = sco_groups.get_etud_groups(etud["etudid"], formsemestre_id)
|
||||
for partition in partitions:
|
||||
if partition["partition_name"]:
|
||||
gr_name = ""
|
||||
@ -303,12 +303,9 @@ def moduleimpl_inscriptions_stats(formsemestre_id):
|
||||
)
|
||||
for mod in options:
|
||||
if can_change:
|
||||
c_link = (
|
||||
'<a class="discretelink" href="moduleimpl_inscriptions_edit?moduleimpl_id=%s">%s</a>'
|
||||
% (
|
||||
mod["moduleimpl_id"],
|
||||
mod["descri"] or "<i>(inscrire des étudiants)</i>",
|
||||
)
|
||||
c_link = '<a class="discretelink" href="moduleimpl_inscriptions_edit?moduleimpl_id=%s">%s</a>' % (
|
||||
mod["moduleimpl_id"],
|
||||
mod["descri"] or "<i>(inscrire des étudiants)</i>",
|
||||
)
|
||||
else:
|
||||
c_link = mod["descri"]
|
||||
|
@ -235,7 +235,7 @@ def ficheEtud(etudid=None):
|
||||
)
|
||||
grlink = '<span class="fontred">%s</span>' % descr["situation"]
|
||||
else:
|
||||
group = sco_groups.get_etud_main_group(etudid, sem)
|
||||
group = sco_groups.get_etud_main_group(etudid, sem["formsemestre_id"])
|
||||
if group["partition_name"]:
|
||||
gr_name = group["group_name"]
|
||||
else:
|
||||
@ -584,7 +584,7 @@ def etud_info_html(etudid, with_photo="1", debug=False):
|
||||
elif etud["cursem"]: # le semestre "en cours" pour l'étudiant
|
||||
sem = etud["cursem"]
|
||||
if sem:
|
||||
groups = sco_groups.get_etud_groups(etudid, sem)
|
||||
groups = sco_groups.get_etud_groups(etudid, formsemestre_id)
|
||||
grc = sco_groups.listgroups_abbrev(groups)
|
||||
H += '<div class="eid_info">En <b>S%d</b>: %s</div>' % (sem["semestre_id"], grc)
|
||||
H += "</div>" # fin partie gauche (eid_left)
|
||||
|
@ -414,7 +414,7 @@ def make_formsemestre_recapcomplet(
|
||||
gr_name = "Déf."
|
||||
is_dem[etudid] = False
|
||||
else:
|
||||
group = sco_groups.get_etud_main_group(etudid, sem)
|
||||
group = sco_groups.get_etud_main_group(etudid, formsemestre_id)
|
||||
gr_name = group["group_name"] or ""
|
||||
is_dem[etudid] = False
|
||||
if rank_partition_id:
|
||||
@ -1020,7 +1020,7 @@ def _gen_cell(key: str, row: dict, elt="td"):
|
||||
"html table cell"
|
||||
klass = row.get(f"_{key}_class")
|
||||
attrs = f'class="{klass}"' if klass else ""
|
||||
order = row.get("_{key}_order")
|
||||
order = row.get(f"_{key}_order")
|
||||
if order:
|
||||
attrs += f' data-order="{order}"'
|
||||
return f'<{elt} {attrs}>{row.get(key, "")}</{elt}>'
|
||||
|
@ -847,7 +847,7 @@ def feuille_saisie_notes(evaluation_id, group_ids=[]):
|
||||
etuds = _get_sorted_etuds(E, etudids, formsemestre_id)
|
||||
for e in etuds:
|
||||
etudid = e["etudid"]
|
||||
groups = sco_groups.get_etud_groups(etudid, sem)
|
||||
groups = sco_groups.get_etud_groups(etudid, formsemestre_id)
|
||||
grc = sco_groups.listgroups_abbrev(groups)
|
||||
|
||||
L.append(
|
||||
@ -1020,7 +1020,7 @@ def _get_sorted_etuds(E, etudids, formsemestre_id):
|
||||
{"etudid": etudid, "formsemestre_id": formsemestre_id}
|
||||
)[0]
|
||||
# Groupes auxquels appartient cet étudiant:
|
||||
e["groups"] = sco_groups.get_etud_groups(etudid, sem)
|
||||
e["groups"] = sco_groups.get_etud_groups(etudid, formsemestre_id)
|
||||
|
||||
# Information sur absence (tenant compte de la demi-journée)
|
||||
jour_iso = ndb.DateDMYtoISO(E["jour"])
|
||||
|
@ -180,7 +180,9 @@ def pdf_trombino_tours(
|
||||
n = 1
|
||||
for m in members:
|
||||
img = sco_trombino._get_etud_platypus_image(m, image_width=PHOTOWIDTH)
|
||||
etud_main_group = sco_groups.get_etud_main_group(m["etudid"], sem)
|
||||
etud_main_group = sco_groups.get_etud_main_group(
|
||||
m["etudid"], sem["formsemestre_id"]
|
||||
)
|
||||
if group_id != etud_main_group["group_id"]:
|
||||
text_group = " (" + etud_main_group["group_name"] + ")"
|
||||
else:
|
||||
|
@ -3229,6 +3229,7 @@ span.ext_sem_moy {
|
||||
}
|
||||
|
||||
/* DataTables */
|
||||
|
||||
table.dataTable tr.odd td {
|
||||
background-color: #ecf5f4;
|
||||
}
|
||||
@ -3250,9 +3251,13 @@ table.table_recap .rang {
|
||||
white-space:nowrap;
|
||||
text-align: right;
|
||||
}
|
||||
table.table_recap .col_ue, table.table_recap .col_moy_gen {
|
||||
table.table_recap .col_ue, table.table_recap .col_moy_gen, table.table_recap .group {
|
||||
border-left: 1px solid blue;
|
||||
}
|
||||
table.table_recap .group {
|
||||
border-left: 1px dashed rgb(160, 160, 160);
|
||||
}
|
||||
|
||||
table.table_recap tfoot th, table.table_recap thead th {
|
||||
text-align: left;
|
||||
padding-left: 10px !important;
|
||||
|
Loading…
Reference in New Issue
Block a user