forked from ScoDoc/ScoDoc
Exports excel recap et jury
This commit is contained in:
parent
44d832bbd5
commit
1cc11cc932
@ -95,11 +95,14 @@ def formsemestre_recapcomplet(
|
|||||||
xml_with_decisions = int(xml_with_decisions)
|
xml_with_decisions = int(xml_with_decisions)
|
||||||
force_publishing = int(force_publishing)
|
force_publishing = int(force_publishing)
|
||||||
filename = scu.sanitize_filename(
|
filename = scu.sanitize_filename(
|
||||||
f"""recap-{formsemestre.titre_num()}-{time.strftime("%Y-%m-%d")}"""
|
f"""{'jury' if mode_jury else 'recap'
|
||||||
|
}{'-evals' if tabformat == 'xlsall' else ''
|
||||||
|
}-{formsemestre.titre_num()}-{time.strftime("%Y-%m-%d")}"""
|
||||||
)
|
)
|
||||||
if is_file:
|
if is_file:
|
||||||
return _formsemestre_recapcomplet_to_file(
|
return _formsemestre_recapcomplet_to_file(
|
||||||
formsemestre,
|
formsemestre,
|
||||||
|
mode_jury=mode_jury,
|
||||||
tabformat=tabformat,
|
tabformat=tabformat,
|
||||||
filename=filename,
|
filename=filename,
|
||||||
xml_with_decisions=xml_with_decisions,
|
xml_with_decisions=xml_with_decisions,
|
||||||
@ -275,6 +278,7 @@ def _formsemestre_recapcomplet_to_html(
|
|||||||
def _formsemestre_recapcomplet_to_file(
|
def _formsemestre_recapcomplet_to_file(
|
||||||
formsemestre: FormSemestre,
|
formsemestre: FormSemestre,
|
||||||
tabformat: str = "json", # xml, xls, xlsall, json
|
tabformat: str = "json", # xml, xls, xlsall, json
|
||||||
|
mode_jury: bool = False,
|
||||||
filename: str = "",
|
filename: str = "",
|
||||||
xml_nodate=False, # format XML sans dates (sert pour debug cache: comparaison de XML)
|
xml_nodate=False, # format XML sans dates (sert pour debug cache: comparaison de XML)
|
||||||
xml_with_decisions=False,
|
xml_with_decisions=False,
|
||||||
@ -282,19 +286,15 @@ def _formsemestre_recapcomplet_to_file(
|
|||||||
):
|
):
|
||||||
"""Calcule et renvoie le tableau récapitulatif."""
|
"""Calcule et renvoie le tableau récapitulatif."""
|
||||||
if tabformat.startswith("xls"):
|
if tabformat.startswith("xls"):
|
||||||
|
include_evaluations = tabformat == "xlsall"
|
||||||
res: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre)
|
res: NotesTableCompat = res_sem.load_formsemestre_results(formsemestre)
|
||||||
include_evaluations = tabformat in {
|
|
||||||
"xlsall",
|
|
||||||
"csv ",
|
|
||||||
} # csv not supported anymore
|
|
||||||
if tabformat != "csv":
|
|
||||||
tabformat = "xlsx"
|
|
||||||
data, filename = gen_formsemestre_recapcomplet_excel(
|
data, filename = gen_formsemestre_recapcomplet_excel(
|
||||||
res,
|
res,
|
||||||
|
mode_jury=mode_jury,
|
||||||
include_evaluations=include_evaluations,
|
include_evaluations=include_evaluations,
|
||||||
filename=filename,
|
filename=filename,
|
||||||
)
|
)
|
||||||
mime, suffix = scu.get_mime_suffix(tabformat)
|
mime, suffix = scu.get_mime_suffix("xlsx")
|
||||||
return scu.send_file(data, filename=filename, mime=mime, suffix=suffix)
|
return scu.send_file(data, filename=filename, mime=mime, suffix=suffix)
|
||||||
elif tabformat == "xml":
|
elif tabformat == "xml":
|
||||||
data = gen_formsemestre_recapcomplet_xml(
|
data = gen_formsemestre_recapcomplet_xml(
|
||||||
@ -458,7 +458,6 @@ def gen_formsemestre_recapcomplet_html_table(
|
|||||||
table_html = cache_class.get(formsemestre.id)
|
table_html = cache_class.get(formsemestre.id)
|
||||||
if table_html is None:
|
if table_html is None:
|
||||||
table = _gen_formsemestre_recapcomplet_table(
|
table = _gen_formsemestre_recapcomplet_table(
|
||||||
formsemestre,
|
|
||||||
res,
|
res,
|
||||||
include_evaluations,
|
include_evaluations,
|
||||||
mode_jury,
|
mode_jury,
|
||||||
@ -472,10 +471,10 @@ def gen_formsemestre_recapcomplet_html_table(
|
|||||||
|
|
||||||
|
|
||||||
def _gen_formsemestre_recapcomplet_table(
|
def _gen_formsemestre_recapcomplet_table(
|
||||||
formsemestre: FormSemestre,
|
|
||||||
res: ResultatsSemestre,
|
res: ResultatsSemestre,
|
||||||
include_evaluations=False,
|
include_evaluations=False,
|
||||||
mode_jury=False,
|
mode_jury=False,
|
||||||
|
convert_values: bool = True,
|
||||||
filename: str = "",
|
filename: str = "",
|
||||||
selected_etudid=None,
|
selected_etudid=None,
|
||||||
) -> TableRecap:
|
) -> TableRecap:
|
||||||
@ -483,10 +482,10 @@ def _gen_formsemestre_recapcomplet_table(
|
|||||||
table_class = TableJury if mode_jury else TableRecap
|
table_class = TableJury if mode_jury else TableRecap
|
||||||
table = table_class(
|
table = table_class(
|
||||||
res,
|
res,
|
||||||
convert_values=True,
|
convert_values=convert_values,
|
||||||
include_evaluations=include_evaluations,
|
include_evaluations=include_evaluations,
|
||||||
mode_jury=mode_jury,
|
mode_jury=mode_jury,
|
||||||
read_only=not formsemestre.can_edit_jury(),
|
read_only=not res.formsemestre.can_edit_jury(),
|
||||||
)
|
)
|
||||||
|
|
||||||
table.data["filename"] = filename
|
table.data["filename"] = filename
|
||||||
@ -496,21 +495,21 @@ def _gen_formsemestre_recapcomplet_table(
|
|||||||
|
|
||||||
def gen_formsemestre_recapcomplet_excel(
|
def gen_formsemestre_recapcomplet_excel(
|
||||||
res: NotesTableCompat,
|
res: NotesTableCompat,
|
||||||
|
mode_jury: bool = False,
|
||||||
include_evaluations=False,
|
include_evaluations=False,
|
||||||
filename: str = "",
|
filename: str = "",
|
||||||
) -> tuple:
|
) -> tuple:
|
||||||
"""Génère le tableau recap en excel (xlsx).
|
"""Génère le tableau recap ou jury en excel (xlsx).
|
||||||
Utilisé pour archives et autres besoins particuliers (API).
|
Utilisé pour menu (export excel), archives et autres besoins particuliers (API).
|
||||||
Attention: le tableau exporté depuis la page html est celui généré en js par DataTables,
|
Attention: le tableau exporté depuis la page html est celui généré en js par DataTables,
|
||||||
et non celui-ci.
|
et non celui-ci.
|
||||||
"""
|
"""
|
||||||
filename += scu.XLSX_SUFFIX
|
table = _gen_formsemestre_recapcomplet_table(
|
||||||
|
|
||||||
table = TableRecap(
|
|
||||||
res,
|
res,
|
||||||
convert_values=False,
|
|
||||||
include_evaluations=include_evaluations,
|
include_evaluations=include_evaluations,
|
||||||
# preferences=sco_preferences.SemPreferences(formsemestre_id=formsemestre.id),
|
mode_jury=mode_jury,
|
||||||
|
convert_values=False,
|
||||||
|
filename=filename,
|
||||||
)
|
)
|
||||||
|
|
||||||
return table.excel(), filename
|
return table.excel(), filename
|
||||||
|
@ -369,7 +369,7 @@ div.logo-logo img {
|
|||||||
box-sizing: content-box;
|
box-sizing: content-box;
|
||||||
margin-top: 10px;
|
margin-top: 10px;
|
||||||
/* -10px */
|
/* -10px */
|
||||||
width: 130px;
|
width: 64px;
|
||||||
/* adapter suivant image */
|
/* adapter suivant image */
|
||||||
/* padding-right: 5px; */
|
/* padding-right: 5px; */
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 69 KiB After Width: | Height: | Size: 19 KiB |
Loading…
Reference in New Issue
Block a user