forked from ScoDoc/ScoDoc
Fix export excel table jury. Closes #868
This commit is contained in:
parent
b2e6ef63b9
commit
2da359ae41
@ -542,8 +542,6 @@ class Identite(models.ScoDocModel):
|
||||
|
||||
def inscriptions(self) -> list["FormSemestreInscription"]:
|
||||
"Liste des inscriptions à des formsemestres, triée, la plus récente en tête"
|
||||
from app.models.formsemestre import FormSemestre, FormSemestreInscription
|
||||
|
||||
return (
|
||||
FormSemestreInscription.query.join(FormSemestreInscription.formsemestre)
|
||||
.filter(
|
||||
@ -569,8 +567,6 @@ class Identite(models.ScoDocModel):
|
||||
(il est rare qu'il y en ai plus d'une, mais c'est possible).
|
||||
Triées par date de début de semestre décroissante (le plus récent en premier).
|
||||
"""
|
||||
from app.models.formsemestre import FormSemestre, FormSemestreInscription
|
||||
|
||||
return (
|
||||
FormSemestreInscription.query.join(FormSemestreInscription.formsemestre)
|
||||
.filter(
|
||||
@ -1099,6 +1095,5 @@ class EtudAnnotation(db.Model):
|
||||
return e
|
||||
|
||||
|
||||
from app.models.formsemestre import FormSemestre
|
||||
from app.models.modules import Module
|
||||
from app.models.formsemestre import FormSemestre, FormSemestreInscription
|
||||
from app.models.moduleimpls import ModuleImpl, ModuleImplInscription
|
||||
|
@ -57,14 +57,12 @@ from app.scodoc import html_sco_header
|
||||
from app.scodoc import sco_assiduites
|
||||
from app.scodoc import codes_cursus
|
||||
from app.scodoc import sco_cache
|
||||
from app.scodoc import sco_edit_ue
|
||||
from app.scodoc import sco_etud
|
||||
from app.scodoc import sco_formsemestre
|
||||
from app.scodoc import sco_formsemestre_inscriptions
|
||||
from app.scodoc import sco_cursus
|
||||
from app.scodoc import sco_cursus_dut
|
||||
from app.scodoc.sco_cursus_dut import etud_est_inscrit_ue
|
||||
from app.scodoc import sco_photos
|
||||
from app.scodoc import sco_preferences
|
||||
from app.scodoc import sco_pv_dict
|
||||
from app.scodoc.sco_permissions import Permission
|
||||
|
@ -110,7 +110,7 @@ def formsemestre_recapcomplet(
|
||||
force_publishing=force_publishing,
|
||||
)
|
||||
|
||||
table_html, table, freq_codes_annuels = _formsemestre_recapcomplet_to_html(
|
||||
table_html, _, freq_codes_annuels = _formsemestre_recapcomplet_to_html(
|
||||
formsemestre,
|
||||
filename=filename,
|
||||
mode_jury=mode_jury,
|
||||
|
@ -8,21 +8,16 @@
|
||||
"""
|
||||
|
||||
import collections
|
||||
import time
|
||||
import numpy as np
|
||||
from flask import g, url_for
|
||||
|
||||
from app.but import cursus_but
|
||||
from app.but import jury_but
|
||||
from app.but.jury_but import (
|
||||
DecisionsProposeesAnnee,
|
||||
DecisionsProposeesRCUE,
|
||||
DecisionsProposeesUE,
|
||||
)
|
||||
from app.but.jury_but import DecisionsProposeesRCUE
|
||||
|
||||
from app.comp.res_compat import NotesTableCompat
|
||||
from app.models import ApcNiveau, UniteEns
|
||||
from app.models.etudiants import Identite
|
||||
from app.models.formsemestre import FormSemestre
|
||||
from app.scodoc.codes_cursus import (
|
||||
BUT_BARRE_RCUE,
|
||||
BUT_RCUE_SUFFISANT,
|
||||
@ -112,9 +107,11 @@ class TableJury(TableRecap):
|
||||
row.add_cell(
|
||||
"autorisations_inscription",
|
||||
"Passage",
|
||||
", ".join("S" + str(i) for i in sorted(autorisations[etud.id]))
|
||||
if etud.id in autorisations
|
||||
else "",
|
||||
(
|
||||
", ".join("S" + str(i) for i in sorted(autorisations[etud.id]))
|
||||
if etud.id in autorisations
|
||||
else ""
|
||||
),
|
||||
group="jury_code_sem",
|
||||
classes=["recorded_code"],
|
||||
)
|
||||
@ -136,6 +133,7 @@ class TableJury(TableRecap):
|
||||
if not self.read_only else "voir"} décisions""",
|
||||
group="col_jury_link",
|
||||
classes=["fontred"] if a_saisir else [],
|
||||
no_excel=True,
|
||||
target=url_for(
|
||||
"notes.formsemestre_validation_etud_form",
|
||||
scodoc_dept=g.scodoc_dept,
|
||||
@ -278,6 +276,7 @@ class RowJury(RowRecap):
|
||||
f"<div>{rcue.ue_1.acronyme}</div><div>{rcue.ue_2.acronyme}</div>",
|
||||
self.table.fmt_note(val),
|
||||
raw_content=val,
|
||||
raw_title=f"{rcue.ue_1.acronyme}-{rcue.ue_2.acronyme}",
|
||||
group="rcue",
|
||||
classes=[note_class],
|
||||
column_classes={"col_rcue"},
|
||||
@ -293,6 +292,7 @@ class RowJury(RowRecap):
|
||||
"empty_code" if not dec_rcue.code_valide else "",
|
||||
],
|
||||
column_classes={"col_rcue"},
|
||||
raw_title=f"{rcue.ue_1.acronyme}-{rcue.ue_2.acronyme}",
|
||||
)
|
||||
|
||||
# # --- Les ECTS validés
|
||||
|
@ -613,6 +613,7 @@ class RowRecap(tb.Row):
|
||||
"etudid": etud.id,
|
||||
"nomprenom": etud.nomprenom,
|
||||
},
|
||||
no_excel=True,
|
||||
target=url_bulletin,
|
||||
target_attrs={"class": "etudinfo", "id": str(etud.id)},
|
||||
)
|
||||
@ -623,7 +624,11 @@ class RowRecap(tb.Row):
|
||||
_, nbabsjust, nbabs = self.table.res.formsemestre.get_abs_count(self.etud.id)
|
||||
self.add_cell("nbabs", "Abs", f"{nbabs:1.0f}", "abs", raw_content=nbabs)
|
||||
self.add_cell(
|
||||
"nbabsjust", "Just.", f"{nbabsjust:1.0f}", "abs", raw_content=nbabsjust
|
||||
"nbabsjust",
|
||||
"Just.",
|
||||
f"{nbabsjust:1.0f}",
|
||||
"abs",
|
||||
raw_content=nbabsjust,
|
||||
)
|
||||
|
||||
def add_moyennes_cols(
|
||||
|
@ -260,12 +260,18 @@ class Table(Element):
|
||||
self.titles.update(titles)
|
||||
|
||||
def add_title(
|
||||
self, col_id, title: str = None, classes: list[str] = None
|
||||
self,
|
||||
col_id,
|
||||
title: str = None,
|
||||
classes: list[str] = None,
|
||||
raw_title: str = None,
|
||||
) -> tuple["Cell", "Cell"]:
|
||||
"""Record this title,
|
||||
and create cells for footer and header if they don't already exist.
|
||||
If specified, raw_title will be used in excel exports.
|
||||
"""
|
||||
title = title or ""
|
||||
|
||||
if col_id not in self.titles:
|
||||
self.titles[col_id] = title
|
||||
if self.head_title_row:
|
||||
@ -275,6 +281,7 @@ class Table(Element):
|
||||
title,
|
||||
classes=classes,
|
||||
group=self.column_group.get(col_id),
|
||||
raw_content=raw_title or title,
|
||||
)
|
||||
if self.foot_title_row:
|
||||
self.foot_title_row.cells[col_id] = self.foot_title_row.add_cell(
|
||||
@ -359,6 +366,7 @@ class Row(Element):
|
||||
data: dict[str, str] = None,
|
||||
elt: str = None,
|
||||
raw_content=None,
|
||||
raw_title: str | None = None,
|
||||
target_attrs: dict = None,
|
||||
target: str = None,
|
||||
column_classes: set[str] = None,
|
||||
@ -384,16 +392,22 @@ class Row(Element):
|
||||
target_attrs=target_attrs,
|
||||
)
|
||||
return self.add_cell_instance(
|
||||
col_id, cell, column_group=group, title=title, no_excel=no_excel
|
||||
col_id,
|
||||
cell,
|
||||
column_group=group,
|
||||
title=title,
|
||||
raw_title=raw_title,
|
||||
no_excel=no_excel,
|
||||
)
|
||||
|
||||
def add_cell_instance(
|
||||
self,
|
||||
col_id: str,
|
||||
cell: "Cell",
|
||||
column_group: str = None,
|
||||
title: str = None,
|
||||
column_group: str | None = None,
|
||||
title: str | None = None,
|
||||
no_excel: bool = False,
|
||||
raw_title: str | None = None,
|
||||
) -> "Cell":
|
||||
"""Add a cell to the row.
|
||||
Si title est None, il doit avoir été ajouté avec table.add_title().
|
||||
@ -410,7 +424,9 @@ class Row(Element):
|
||||
self.table.column_group[col_id] = column_group
|
||||
|
||||
if title is not None:
|
||||
self.table.add_title(col_id, title, classes=cell.classes)
|
||||
self.table.add_title(
|
||||
col_id, title, classes=cell.classes, raw_title=raw_title
|
||||
)
|
||||
|
||||
return cell
|
||||
|
||||
@ -487,7 +503,7 @@ class Cell(Element):
|
||||
self.attrs["scope"] = "row"
|
||||
|
||||
self.data = data.copy() if data else {}
|
||||
self.raw_content = raw_content or content
|
||||
self.raw_content = content if raw_content is None else raw_content
|
||||
self.target = target
|
||||
self.target_attrs = target_attrs or {}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user