forked from ScoDoc/ScoDoc
Update opolka/ScoDoc from ScoDoc/ScoDoc #2
@ -49,6 +49,7 @@ from zipfile import ZipFile
|
||||
|
||||
import numpy as np
|
||||
import pandas as pd
|
||||
import jinja2
|
||||
|
||||
from app.pe.rcss import pe_rcs
|
||||
from app.pe.moys import pe_sxtag
|
||||
@ -419,7 +420,8 @@ class JuryPE(object):
|
||||
onglets = []
|
||||
for onglet, df in self.synthese.items():
|
||||
# Conversion colonnes en multiindex
|
||||
df = convert_colonnes_to_multiindex(df)
|
||||
df_final = df.copy()
|
||||
df_final = convert_colonnes_to_multiindex(df_final)
|
||||
# Nom de l'onglet
|
||||
if isinstance(onglet, tuple):
|
||||
if onglet[1] == pe_moytag.CODE_MOY_COMPETENCES:
|
||||
@ -430,7 +432,7 @@ class JuryPE(object):
|
||||
nom_onglet = onglet
|
||||
onglets += [nom_onglet]
|
||||
# écriture dans l'onglet:
|
||||
df.to_excel(writer, nom_onglet, index=True, header=True)
|
||||
df_final.to_excel(writer, nom_onglet, index=True, header=True)
|
||||
pe_affichage.pe_print(f"=> Export excel de {', '.join(onglets)}")
|
||||
output.seek(0)
|
||||
|
||||
@ -567,9 +569,67 @@ class JuryPE(object):
|
||||
etudiant = self.etudiants.identites[etudid]
|
||||
nom = etudiant.nom
|
||||
prenom = etudiant.prenom # initial du prénom
|
||||
html = "toto"
|
||||
|
||||
# Accès au template
|
||||
environnement = jinja2.Environment(
|
||||
loader=jinja2.FileSystemLoader("app/templates/")
|
||||
)
|
||||
template = environnement.get_template("pe/pe_view_resultats_etudiant.j2")
|
||||
|
||||
# Colonnes des tableaux htmls => competences
|
||||
competences = []
|
||||
for aggregat in pe_rcs.TOUS_LES_RCS_AVEC_PLUSIEURS_SEM:
|
||||
# L'interclassement associé
|
||||
interclass = self.interclasstags[pe_moytag.CODE_MOY_COMPETENCES][aggregat]
|
||||
competences.extend(interclass.champs_sorted)
|
||||
competences = sorted(set(competences))
|
||||
colonnes_html = competences
|
||||
|
||||
tags = self._do_tags_list(self.interclasstags)
|
||||
|
||||
# Les données par UE
|
||||
moyennes = {}
|
||||
for tag in tags:
|
||||
moyennes[tag] = {}
|
||||
# Les données de synthèse
|
||||
df = self.synthese[(tag, pe_moytag.CODE_MOY_COMPETENCES)]
|
||||
for aggregat in pe_rcs.TOUS_LES_RCS_AVEC_PLUSIEURS_SEM:
|
||||
moyennes[tag][aggregat] = {}
|
||||
for comp in competences + ["Général"]:
|
||||
moyennes[tag][aggregat][comp] = {
|
||||
"note": "",
|
||||
"rang_groupe": "",
|
||||
"rang_promo": "",
|
||||
}
|
||||
colonne = pe_moytag.get_colonne_df(
|
||||
aggregat, tag, comp, "Groupe", "note"
|
||||
)
|
||||
if colonne in df.columns:
|
||||
valeur = df.loc[etudid, colonne]
|
||||
if not np.isnan(valeur):
|
||||
moyennes[tag][aggregat][comp]["note"] = round(valeur, 2)
|
||||
colonne = pe_moytag.get_colonne_df(
|
||||
aggregat, tag, comp, "Groupe", "rang"
|
||||
)
|
||||
if colonne in df.columns:
|
||||
valeur = df.loc[etudid, colonne]
|
||||
if valeur != "nan":
|
||||
moyennes[tag][aggregat][comp]["rang_groupe"] = valeur
|
||||
colonne = pe_moytag.get_colonne_df(
|
||||
aggregat, tag, comp, "Promo", "rang"
|
||||
)
|
||||
if colonne in df.columns:
|
||||
valeur = df.loc[etudid, colonne]
|
||||
if valeur != "nan":
|
||||
moyennes[tag][aggregat][comp]["rang_promo"] = valeur
|
||||
|
||||
html = template.render(
|
||||
nom=nom,
|
||||
prenom=prenom,
|
||||
colonnes_html=colonnes_html,
|
||||
tags=tags,
|
||||
moyennes=moyennes,
|
||||
)
|
||||
# for onglet, df_synthese in self.synthese.items():
|
||||
# if isinstance(onglet, tuple): # Les onglets autres que "administratif"
|
||||
# tag = onglet[0]
|
||||
|
@ -3,9 +3,9 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{% block title %}Service d'un prof{% endblock %}</title>
|
||||
<link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/water.css">
|
||||
<title>PE de {{ nom }} }}</title>
|
||||
<!--link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/water.css"-->
|
||||
<style>
|
||||
.flash { padding: 8px; color: white; border-radius: 15px; font-weight: bold; }
|
||||
.success { background-color: limegreen; }
|
||||
@ -21,7 +21,7 @@
|
||||
|
||||
{% for tag in tags %}
|
||||
|
||||
<h3>{{ tag }}</h3>
|
||||
<h3>Tag {{ tag }}</h3>
|
||||
|
||||
{% endfor %}
|
||||
|
||||
@ -31,6 +31,40 @@
|
||||
|
||||
<h3>{{ tag }}</h3>
|
||||
|
||||
<table>
|
||||
<!-- Entêtes/Colonnes -->
|
||||
<thead>
|
||||
<tr>
|
||||
<th rowspan="2"></th>
|
||||
{% for col in colonnes_html %}
|
||||
<th colspan="3">{{ col }}</th>
|
||||
{% endfor %}
|
||||
<th colspan="3">Général</th>
|
||||
</tr>
|
||||
<tr>
|
||||
{% for col in colonnes_html %}
|
||||
<td></td><td>Groupe</td><td>Promo</td>
|
||||
{% endfor %}
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for aggregat in moyennes[tag] %}
|
||||
<tr>
|
||||
<td>{{ aggregat }}</td>
|
||||
{% for comp in moyennes[tag][aggregat] %}
|
||||
|
||||
<td>{{ moyennes[tag][aggregat][comp]["note"] }}</td>
|
||||
<td>{{ moyennes[tag][aggregat][comp]["rang_groupe"] }}</td>
|
||||
<td>{{ moyennes[tag][aggregat][comp]["rang_promo"] }}</td>
|
||||
{% endfor %}
|
||||
<td>{{ moyennes[tag][aggregat]["Général"]["note"] }}</td>
|
||||
<td>{{ moyennes[tag][aggregat]["Général"]["rang_groupe"] }}</td>
|
||||
<td>{{ moyennes[tag][aggregat]["Général"]["rang_promo"] }}</td>
|
||||
</tr>
|
||||
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endfor %}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user