1
0
forked from ScoDoc/ScoDoc

intégration v0 bulletin BUT par Seb. L.

This commit is contained in:
Emmanuel Viennet 2021-12-06 20:58:39 +01:00
parent 177f23b48c
commit 3b30a67b17
4 changed files with 589 additions and 3 deletions

View File

@ -0,0 +1,238 @@
/* Bulletin BUT, Seb. L. 2021-12-06 */
/*******************/
/* Styles généraux */
/*******************/
:root{
--couleurPrincipale: #09c;
--couleurSecondaire: #0c9;
--couleurIntense: #c09;
}
body{
font-family: arial;
background: #f0f0f0;
}
.wait{
width: 60px;
height: 6px;
margin: auto;
background: #424242; /* la réponse à tout */
animation: wait .4s infinite alternate;
}
@keyframes wait{
100%{transform: translateY(40px) rotate(1turn);}
}
main{
max-width: 1000px;
margin: auto;
display: none;
}
.ready .wait{display: none;}
.ready main{display: block;}
h2{
margin: 0;
color: var(--couleurPrincipale)
}
section{
background: #FFF;
border-radius: 16px;
border: 1px solid #AAA;
padding: 16px 32px;
margin: 8px 0;
}
section>div:nth-child(1){
display: flex;
justify-content: space-between;
align-items: center;
gap: 8px;
}
.CTA_Liste{
display: flex;
gap: 4px;
align-items: center;
background: var(--couleurIntense);
color: #FFF;
padding: 4px 8px;
border-radius: 4px;
box-shadow: 0 2px 2px rgba(0,0,0,0.26);
cursor: pointer;
}
.CTA_Liste>svg{
transition: 0.2s;
}
.CTA_Liste:hover{
outline: 2px solid #424242;
}
.listeOff svg{
transform: rotate(180deg);
}
.listeOff .syntheseModule,
.listeOff .eval{
display: none;
}
/***********************/
/* Options d'affichage */
/***********************/
.hide_abs .absences,
.hide_abs_modules .module>.absences,
.hide_all_evals .eval,
.hide_coef .synthese em,
.hide_coef .eval>em,
.hide_date_inscr .dateInscription,
.hide_ects .ects
{
display: none;
}
/************/
/* Etudiant */
/************/
.etudiant{
display: flex;
align-items: center;
gap: 16px;
border-color: var(--couleurPrincipale);
background: var(--couleurPrincipale);
color: #FFF;
}
.civilite{
font-weight: bold;
}
/************/
/* Semestre */
/************/
.infoSemestre{
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 4px;
}
.infoSemestre>div{
border: 1px solid var(--couleurIntense);
padding: 4px 8px;
border-radius: 4px;
display: grid;
grid-template-columns: auto auto;
column-gap: 4px;
}
.infoSemestre>div:nth-child(1){
margin-right: auto;
}
.infoSemestre>div>div:nth-child(even){
text-align: right;
}
.rang{
text-decoration: underline var(--couleurIntense);
}
.enteteSemestre{
color: var(--couleurSecondaire);
font-weight: bold;
font-size: 20px;
margin-bottom: 4px;
}
/***************/
/* Synthèse */
/***************/
.synthese>.ue{
background: var(--couleurPrincipale);
}
.synthese h3{
background: var(--couleurPrincipale);
}
.synthese em,
.eval em{
opacity: 0.6;
width: 70px;
display: inline-block;
}
/***************/
/* Evaluations */
/***************/
.module, .ue{
background: var(--couleurSecondaire);
color: #FFF;
padding: 4px 32px;
border-radius: 4px;
display: flex;
gap: 16px;
margin: 4px 0 2px 0;
overflow: auto;
}
h3{
display: flex;
align-items: center;
margin: 0 auto 0 0;
position: sticky;
left: -32px;
z-index: 1;
font-size: 16px;
background: var(--couleurSecondaire);
}
.moyenne{
font-weight: bold;
text-align: right;
}
.info{
opacity: 0.9;
}
.eval, .syntheseModule{
position: relative;
display: flex;
justify-content: space-between;
margin: 0 28px;
padding: 0px 4px;
border-bottom: 1px solid #aaa;
}
.eval:hover, .syntheseModule:hover{
background: var(--couleurIntense);
color: #FFF;
}
.complement{
pointer-events:none;
position: absolute;
bottom: 100%;
right: 0;
padding: 8px;
border-radius: 4px;
background: #FFF;
color: #000;
border: 1px solid var(--couleurIntense);
opacity: 0;
display: grid;
grid-template-columns: auto auto;
column-gap: 4px;
}
.eval:hover .complement{
opacity: 1;
z-index: 1;
}
.complement>div:nth-child(even){
text-align: right;
}
.complement>div:nth-child(1),
.complement>div:nth-child(2){
font-weight: bold;
}
.complement>div:nth-child(1),
.complement>div:nth-child(7){
margin-bottom: 8px;
}
.absences{
display: grid;
grid-template-columns: auto auto;
column-gap: 4px;
text-align: right;
border-left: 1px solid;
padding-left: 16px;
}
.absences>div:nth-child(1),
.absences>div:nth-child(2){
font-weight: bold;
}

View File

@ -0,0 +1,243 @@
/* Il manque :
- rangs
- Synthèse : moyenne UE
- Synthèse : min, max, moy classe
- Synthèse : absences
- Eval : absences
Moi :
"show_codemodules" :true,
"show_minmax": true,
"show_minmax_eval": true,
"show_minmax_mod": false,
"show_mod_rangs": false,
"show_moypromo": true,
"show_rangs": true,
"show_ue_cap_current": true,
"show_ue_cap_details": true,
"show_ue_rangs": true,
"show_uevalid": true,
*/
/*****************************/
/* Gestionnaire d'événements */
/*****************************/
document.querySelectorAll(".CTA_Liste").forEach(e => {
e.addEventListener("click", listeOnOff)
})
function listeOnOff() {
this.parentElement.parentElement.classList.toggle("listeOff")
}
/*****************************/
/* Recupération et affichage */
/*****************************/
fetch(dataSrc)
.then(r => { return r.json() })
.then(json => showData(json))
function showData(data) {
showInformations(data);
showSemestre(data);
showSynthese(data);
showEvaluations(data);
setOptions(data.options);
document.body.classList.add("ready");
}
/********************************/
/* Informations sur l'étudiant */
/********************************/
function showInformations(data) {
document.querySelector(".studentPic").src = data.etudiant.photo_url || "default_Student.svg";
let output = `
<div class=info_etudiant>
<div class=civilite>
${civilite(data.etudiant.civilite)}
${data.etudiant.nom}
${data.etudiant.prenom}
né${(data.etudiant.civilite == "F") ? "e" : ""} le ${ISOToDate(data.etudiant.date_naissance)}
</div>
<div class=numerosEtudiant>
Numéro étudiant : ${data.etudiant.code_nip}
Code INE : ${data.etudiant.code_ine}
</div>
<div>${data.formation.titre}</div>
</div>
`;
document.querySelector(".infoEtudiant").innerHTML = output;
}
/*******************************/
/* Information sur le semestre */
/*******************************/
function showSemestre(data) {
document.querySelector("h2").innerHTML += data.semestre.numero;
document.querySelector(".dateInscription").innerHTML += ISOToDate(data.semestre.inscription);
let output = `
<div>
<div class=enteteSemestre>Moyenne</div><div class=enteteSemestre>${data.semestre.notes.value}</div>
<div class=rang>Rang :</div><div class=rang>${data.semestre.rang.value} / ${data.semestre.rang.total}</div>
<div>Max. promo. :</div><div>${data.semestre.notes.max}</div>
<div>Moy. promo. :</div><div>${data.semestre.notes.moy}</div>
<div>Min. promo. :</div><div>${data.semestre.notes.min}</div>
</div>
${data.semestre.groupes.map(groupe => {
return `
<div>
<div class=enteteSemestre>Groupe</div><div class=enteteSemestre>${groupe.nom}</div>
<div class=rang>Rang :</div><div class=rang>${groupe.rang.value} / ${groupe.rang.total}</div>
<div>Max. groupe :</div><div>${groupe.notes.max}</div>
<div>Moy. groupe :</div><div>${groupe.notes.min}</div>
<div>Min. groupe :</div><div>${groupe.notes.min}</div>
</div>
`;
}).join("")
}
`;
document.querySelector(".infoSemestre").innerHTML = output;
}
/*******************************/
/* Synthèse */
/*******************************/
function showSynthese(data) {
let output = ``;
Object.entries(data.ues).forEach(([ue, dataUE]) => {
output += `
<div class=ue>
<h3>
${(dataUE.competence) ? dataUE.competence + " - " : ""}${ue}
</h3>
<div>
<div class=moyenne>Moyenne&nbsp;:&nbsp;${dataUE.moyenne?.value || "-"}</div>
<div class=info>
Bonus&nbsp;:&nbsp;${dataUE.bonus || 0}&nbsp;-
Malus&nbsp;:&nbsp;${dataUE.malus || 0}
<span class=ects>&nbsp;-
ECTS&nbsp;:&nbsp;${dataUE.ECTS.acquis}&nbsp;/&nbsp;${dataUE.ECTS.total}
</span>
</div>
</div>
<div class=absences>
<div>Abs&nbsp;inj.</div><div>${dataUE.absences?.injustifie || 0}</div>
<div>Total</div><div>${dataUE.absences?.total || 0}</div>
</div>
</div>
${synthese(dataUE.ressources)}
${synthese(dataUE.saes)}
`;
});
document.querySelector(".synthese").innerHTML = output;
function synthese(modules) {
let output = "";
Object.entries(modules).forEach(([module, dataModule]) => {
let titre = data.ressources[module]?.titre || data.saes[module]?.titre;
output += `
<div class=syntheseModule>
<div>${module}&nbsp;- ${titre}</div>
<div>
${dataModule.moyenne}
<em>Coef. ${dataModule.coef}</em>
</div>
</div>
`;
})
return output;
}
}
/*******************************/
/* Evaluations */
/*******************************/
function showEvaluations(data) {
document.querySelector(".evaluations").innerHTML = module(data.ressources);
document.querySelector(".sae").innerHTML += module(data.saes);
function module(module) {
let output = "";
Object.entries(module).forEach(([numero, content]) => {
output += `
<div>
<div class=module>
<h3>${numero} - ${content.titre}</h3>
<div>
<div class=moyenne>Moyenne&nbsp;indicative&nbsp;:&nbsp;${content.moyenne.value}</div>
<div class=info>
Classe&nbsp;:&nbsp;${content.moyenne.moy}&nbsp;-
Max&nbsp;:&nbsp;${content.moyenne.max}&nbsp;-
Min&nbsp;:&nbsp;${content.moyenne.min}
</div>
</div>
<div class=absences>
<div>Abs&nbsp;inj.</div><div>${content.absences?.injustifie || 0}</div>
<div>Total</div><div>${content.absences?.total || 0}</div>
</div>
</div>
${evaluation(content.evaluations)}
</div>
`;
})
return output;
}
function evaluation(evaluations) {
let output = "";
evaluations.forEach(eval => {
output += `
<div class=eval>
<div>${eval.description}</div>
<div>
${eval.note.value}
<em>Coef. ${eval.coef}</em>
</div>
<div class=complement>
<div>Coef</div><div>${eval.coef}</div>
<div>Max. promo.</div><div>${eval.note.max}</div>
<div>Moy. promo.</div><div>${eval.note.moy}</div>
<div>Min. promo.</div><div>${eval.note.min}</div>
${Object.entries(eval.poids).map(([UE, poids]) => {
return `
<div>Poids ${UE}</div>
<div>${poids}</div>
`;
}).join("")}
</div>
</div>
`;
})
return output;
}
}
/********************/
/* Options */
/********************/
function setOptions(options) {
Object.entries(options).forEach(([option, value]) => {
if (value === false) {
document.body.classList.add(option.replace("show", "hide"))
}
})
}
/********************/
/* Fonctions d'aide */
/********************/
function civilite(txt) {
switch (txt) {
case "M": return "M.";
case "F": return "Mme";
default: return "";
}
}
function ISOToDate(ISO) {
return ISO.split("-").reverse().join("/");
}

View File

@ -0,0 +1,92 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Relevé de notes d'un semestre">
<title>Relevé de notes</title>
<link rel="stylesheet" href="/ScoDoc/static/css/bulletin-but.css">
</head>
<body spellcheck=true contenteditable=//true>
<div class="wait"></div>
<main class="releve">
<!--------------------------->
<!-- Info. étudiant -->
<!--------------------------->
<section class=etudiant>
<img class=studentPic src="" alt="Photo de l'étudiant" width=100 height=120>
<div class=infoEtudiant></div>
</section>
<!--------------------------->
<!-- Semestre -->
<!--------------------------->
<section>
<h2>Semestre </h2>
<div class=dateInscription>Inscrit le </div>
<em>Les moyennes servent à situer l'étudiant dans la promotion et ne correspondent pas à des validations de
compétences ou d'UE.</em>
<div class=infoSemestre></div>
</section>
<!--------------------------->
<!-- Synthèse -->
<!--------------------------->
<section>
<div>
<div>
<h2>Synthèse</h2>
<em>La moyenne des ressources dans une UE dépend des poids donnés aux évaluations.</em>
</div>
<div class=CTA_Liste>
Liste <svg xmlns="http://www.w3.org/2000/svg" width="26" height="26" viewBox="0 0 24 24" fill="none"
stroke="#ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M18 15l-6-6-6 6" />
</svg>
</div>
</div>
<div class=synthese></div>
</section>
<!--------------------------->
<!-- Evaluations -->
<!--------------------------->
<section>
<div>
<h2>Ressources</h2>
<div class=CTA_Liste>
Liste <svg xmlns="http://www.w3.org/2000/svg" width="26" height="26" viewBox="0 0 24 24" fill="none"
stroke="#ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M18 15l-6-6-6 6" />
</svg>
</div>
</div>
<div class=evaluations></div>
</section>
<section>
<div>
<h2>SAÉ</h2>
<div class=CTA_Liste>
Liste <svg xmlns="http://www.w3.org/2000/svg" width="26" height="26" viewBox="0 0 24 24" fill="none"
stroke="#ffffff" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M18 15l-6-6-6 6" />
</svg>
</div>
</div>
<div class=sae></div>
</section>
</main>
<script>
let dataSrc = "{{bul_url|safe}}";
</script>
<script src="/ScoDoc/static/js/bulletin-but.js"></script>
</body>
</html>

View File

@ -38,7 +38,7 @@ from operator import itemgetter
from xml.etree import ElementTree
import flask
from flask import url_for, jsonify
from flask import url_for, jsonify, render_template
from flask import current_app, g, request
from flask_login import current_user
from werkzeug.utils import redirect
@ -290,8 +290,21 @@ def formsemestre_bulletinetud(
formsemestre = FormSemestre.query.get_or_404(formsemestre_id)
if formsemestre.formation.is_apc():
etud = models.Identite.query.get_or_404(etudid)
r = bulletin_but.ResultatsSemestreBUT(formsemestre)
return jsonify(r.bulletin_etud(etud, formsemestre))
if format == "json":
r = bulletin_but.ResultatsSemestreBUT(formsemestre)
return jsonify(r.bulletin_etud(etud, formsemestre))
elif format == "html":
return render_template(
"but/bulletin.html",
title="Bulletin BUT",
bul_url=url_for(
"notes.formsemestre_bulletinetud",
scodoc_dept=g.scodoc_dept,
formsemestre_id=formsemestre_id,
etudid=etudid,
format="json",
),
)
return sco_bulletins.formsemestre_bulletinetud(
etudid=etudid,