forked from ScoDoc/ScoDoc
169 lines
5.3 KiB
Python
169 lines
5.3 KiB
Python
|
# -*- coding: utf-8 -*-
|
||
|
|
||
|
"""
|
||
|
A executer apres s'etre place dans /opt/scodoc/Products/ScoDoc
|
||
|
et en lancant l'interpreteur avec /opt/scodoc/bin/zopectl debug
|
||
|
|
||
|
execfile("test_jurype.py")
|
||
|
|
||
|
|
||
|
@author: barasc
|
||
|
Juin 2017
|
||
|
"""
|
||
|
import pprint
|
||
|
|
||
|
from debug import *
|
||
|
|
||
|
import sco_utils
|
||
|
import sco_formsemestre
|
||
|
import sco_codes_parcours
|
||
|
|
||
|
import pe_tools
|
||
|
|
||
|
reload(pe_tools) # inutile sauf en debug interactif
|
||
|
import pe_tagtable
|
||
|
|
||
|
reload(pe_tagtable)
|
||
|
import pe_semestretag
|
||
|
|
||
|
reload(pe_semestretag)
|
||
|
import pe_settag
|
||
|
|
||
|
reload(pe_settag)
|
||
|
import pe_jurype
|
||
|
|
||
|
reload(pe_jurype)
|
||
|
import codecs
|
||
|
import pe_avislatex
|
||
|
|
||
|
reload(pe_avislatex)
|
||
|
|
||
|
# ****************************************************************************
|
||
|
# Initialisations generales
|
||
|
# ****************************************************************************
|
||
|
context = go_dept(app, "RT") # se place dans le departement RT
|
||
|
authuser = app.acl_users.getUserById("admin")
|
||
|
sems = (
|
||
|
context.Notes.formsemestre_list()
|
||
|
) # Renvoie la liste de tous les semestres de la BDD
|
||
|
|
||
|
qui = "emmanuel"
|
||
|
if qui == "cleo":
|
||
|
fid = "SEM9045" # Choix du semestre sur lequel sera fait le calcul du jury (ici promo 2016 avec tous les résultats)
|
||
|
# fid = 'SEM14440' # Cas d'une promo dans laquelle manque au moins le S4
|
||
|
else:
|
||
|
fid = "SEM27456" # RT S3 jan 2016
|
||
|
|
||
|
print("Semestre=", fid)
|
||
|
|
||
|
if qui == "cleo":
|
||
|
nom = "BRUN" # Choix du nom de l'étudiant dont les résultats seront affichés sur la console
|
||
|
else:
|
||
|
nom = "ROSSE"
|
||
|
|
||
|
# paramètres des avis Latex
|
||
|
REPERTOIRE_MODELES = "tmp/avis/modeles/"
|
||
|
REPERTOIRE_ECRITURE_AVIS = "tmp/avis/"
|
||
|
|
||
|
# class = "avisPE.cls"
|
||
|
# main = "avis.tex" # Fichier principal de compilation
|
||
|
modele = "un_avis.tex" # Modele à actualiser au regard des résultats de l'étudiant
|
||
|
|
||
|
# *****************************************************************************
|
||
|
# Calcul du Jury PE
|
||
|
# *****************************************************************************
|
||
|
# semsDUT = [sem for sem in sems if 1 <= sem['semestre_id'] <= 4 ]
|
||
|
semBase = sco_formsemestre.get_formsemestre(context, fid)
|
||
|
jury = pe_jurype.JuryPE(context, semBase)
|
||
|
|
||
|
|
||
|
# *****************************************************************************
|
||
|
# Affichage des résultats (texte)
|
||
|
# *****************************************************************************
|
||
|
etudid = [
|
||
|
etudid for etudid in jury.syntheseJury if jury.syntheseJury[etudid]["nom"] == nom
|
||
|
][0]
|
||
|
resEtudiant = jury.syntheseJury[etudid] # Résultat de l'étudiant au jury PE
|
||
|
|
||
|
# Parcours
|
||
|
parcours = resEtudiant["parcours"][::-1]
|
||
|
print("Parcours de %s %s" % (resEtudiant["prenom"], resEtudiant["nom"]))
|
||
|
for (no, sem) in enumerate(parcours):
|
||
|
print(" %d) %s" % (no + 1, sem))
|
||
|
|
||
|
# Bilan synthétique par semestre et par tag
|
||
|
for sem in ["S1", "S2", "S3", "S4", "1A", "2A", "3S", "4S"]:
|
||
|
if sem in ["S1", "S2", "S3", "S4"]:
|
||
|
print("Semestre %s" % (sem))
|
||
|
elif sem in ["1A", "2A"]:
|
||
|
print("Annee %s" % (sem))
|
||
|
elif sem == "3S":
|
||
|
print("Fusion S1/S2/S3")
|
||
|
else:
|
||
|
print("Fusion S1/S2/S3/S4")
|
||
|
|
||
|
allTags = resEtudiant[sem]["groupe"].keys()
|
||
|
allTags.extend(resEtudiant[sem]["promo"].keys())
|
||
|
allTags = sorted(list(set(allTags))) # tous les tags du groupe et de la promo
|
||
|
|
||
|
restxt = ""
|
||
|
for tag in allTags:
|
||
|
chaine = " * %20s\t" % (tag)
|
||
|
|
||
|
for ensembleRes in [resEtudiant[sem]["groupe"], resEtudiant[sem]["promo"]]:
|
||
|
if tag in ensembleRes:
|
||
|
(note, coeff, classement, nb_inscrits, vmoy, vmax, vmin) = ensembleRes[
|
||
|
tag
|
||
|
]
|
||
|
note = "%2.2f" % note if isinstance(note, float) else str(note)
|
||
|
classement = "None" if classement == None else classement
|
||
|
nb_inscrits = (
|
||
|
("%d" % nb_inscrits)
|
||
|
if isinstance(nb_inscrits, int)
|
||
|
else str(nb_inscrits)
|
||
|
)
|
||
|
vmin = "%2.2f" % vmin if isinstance(vmin, float) else str(vmin)
|
||
|
vmoy = "%2.2f" % vmoy if isinstance(vmoy, float) else str(vmoy)
|
||
|
vmax = "%2.2f" % vmax if isinstance(vmax, float) else str(vmax)
|
||
|
|
||
|
chaine += "%5s\t%5s/%2s\t%5s/%5s/%5s\t" % (
|
||
|
note,
|
||
|
classement,
|
||
|
nb_inscrits,
|
||
|
vmin,
|
||
|
vmoy,
|
||
|
vmax,
|
||
|
)
|
||
|
else:
|
||
|
chaine += "miss.\t" * 3
|
||
|
|
||
|
restxt += chaine + "\n"
|
||
|
print(restxt)
|
||
|
|
||
|
# Sauvegarde du zip contenant les CSV:
|
||
|
filename = "/tmp/test_pe.zip"
|
||
|
print("Enregistrement du ZIP: ", filename)
|
||
|
f = open(filename, "w")
|
||
|
f.write(jury.get_zipped_data())
|
||
|
f.close()
|
||
|
|
||
|
# *****************************************************************************
|
||
|
# Genere l'avis latex
|
||
|
# *****************************************************************************
|
||
|
# Choix d'un modele d'avis PE
|
||
|
|
||
|
|
||
|
# Genere l'avis PE
|
||
|
print("Avis PE de %s (%s)" % (jury.syntheseJury[etudid]["nom"], etudid))
|
||
|
un_avis_latex = pe_avislatex.get_code_latex_from_modele(
|
||
|
REPERTOIRE_MODELES + "un_avis.tex"
|
||
|
)
|
||
|
code_latex = pe_avislatex.get_code_latex_avis_etudiant(
|
||
|
jury.syntheseJury[etudid], un_avis_latex
|
||
|
)
|
||
|
|
||
|
# Sauvegarde l'avis
|
||
|
fid = codecs.open(REPERTOIRE_ECRITURE_AVIS + modele, "w", encoding="utf-8")
|
||
|
fid.write(code_latex)
|
||
|
fid.close()
|