forked from ScoDoc/ScoDoc
update to 44d674e de Scodoc_Notes
This commit is contained in:
parent
4334a83c17
commit
7da5e0a5c3
@ -31,7 +31,7 @@ import pprint
|
|||||||
"""
|
"""
|
||||||
La fonction bonus_sport reçoit:
|
La fonction bonus_sport reçoit:
|
||||||
|
|
||||||
- notes_sport: la liste des notes des modules de sport et culture (une note par module);
|
- notes_sport: la liste des notes des modules de sport et culture (une note par module de l'UE de type sport/culture);
|
||||||
- coefs: un coef (float) pondérant chaque note (la plupart des bonus les ignorent);
|
- coefs: un coef (float) pondérant chaque note (la plupart des bonus les ignorent);
|
||||||
- infos: dictionnaire avec des données pouvant être utilisées pour les calculs.
|
- infos: dictionnaire avec des données pouvant être utilisées pour les calculs.
|
||||||
Ces données dépendent du type de formation.
|
Ces données dépendent du type de formation.
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
margin: auto;
|
margin: auto;
|
||||||
}
|
}
|
||||||
h1{
|
h1{
|
||||||
|
|
||||||
font-weight: 100;
|
font-weight: 100;
|
||||||
}
|
}
|
||||||
/**********************/
|
/**********************/
|
||||||
@ -41,27 +40,24 @@ h1{
|
|||||||
/* Zone compétences */
|
/* Zone compétences */
|
||||||
/**********************/
|
/**********************/
|
||||||
.competences{
|
.competences{
|
||||||
display: flex;
|
display: grid;
|
||||||
gap: 4px;
|
gap: 4px;
|
||||||
|
margin-top: 8px;
|
||||||
}
|
}
|
||||||
.competence{
|
.competences>div{
|
||||||
flex: 1;
|
|
||||||
}
|
|
||||||
.competence>div{
|
|
||||||
padding: 4px 8px;
|
padding: 4px 8px;
|
||||||
margin-top: 4px;
|
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
.comp1{background:#a44;}
|
.comp1{background:#a44}
|
||||||
.comp2{background:#84a}
|
.comp2{background:#84a}
|
||||||
.comp3{background:#a84}
|
.comp3{background:#a84}
|
||||||
.comp4{background:#8a4}
|
.comp4{background:#8a4}
|
||||||
.comp5{background:#4a8}
|
.comp5{background:#4a8}
|
||||||
.comp6{background:#48a}
|
.comp6{background:#48a}
|
||||||
|
|
||||||
.competence>.focus{
|
.competences>.focus{
|
||||||
outline: 2px solid;
|
outline: 2px solid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,14 +13,17 @@ class ref_competences extends HTMLElement {
|
|||||||
/* Style du module */
|
/* Style du module */
|
||||||
const styles = document.createElement('link');
|
const styles = document.createElement('link');
|
||||||
styles.setAttribute('rel', 'stylesheet');
|
styles.setAttribute('rel', 'stylesheet');
|
||||||
|
if (location.href.split("/")[3] == "ScoDoc") {
|
||||||
styles.setAttribute('href', '/ScoDoc/static/css/ref-competences.css');
|
styles.setAttribute('href', '/ScoDoc/static/css/ref-competences.css');
|
||||||
|
} else {
|
||||||
|
styles.setAttribute('href', 'ref-competences.css');
|
||||||
|
}
|
||||||
|
|
||||||
this.shadow.appendChild(styles);
|
this.shadow.appendChild(styles);
|
||||||
}
|
}
|
||||||
|
|
||||||
set setData(data) {
|
set setData(data) {
|
||||||
this.data = data;
|
this.data = data;
|
||||||
/* this.shadow.querySelector("h1").innerText = "BUT " + data.specialite_long; */
|
|
||||||
this.parcours();
|
this.parcours();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -32,62 +35,61 @@ class ref_competences extends HTMLElement {
|
|||||||
div.addEventListener("click", (event) => { this.competences(event, cle) })
|
div.addEventListener("click", (event) => { this.competences(event, cle) })
|
||||||
parcoursDIV.appendChild(div);
|
parcoursDIV.appendChild(div);
|
||||||
})
|
})
|
||||||
|
this.initCompetences();
|
||||||
|
}
|
||||||
|
|
||||||
|
initCompetences() {
|
||||||
|
this.competencesNumber = {};
|
||||||
|
let gridTemplate = "";
|
||||||
|
let i = 0;
|
||||||
|
Object.keys(this.data.competences).forEach(competence => {
|
||||||
|
gridTemplate += `[${competence}] auto`;
|
||||||
|
this.competencesNumber[competence] = 1 + i++ % 6;
|
||||||
|
})
|
||||||
|
this.shadow.querySelector(".competences").style.gridTemplateColumns = gridTemplate;
|
||||||
}
|
}
|
||||||
|
|
||||||
competences(event, cle) {
|
competences(event, cle) {
|
||||||
this.shadow.querySelector(".parcours>.focus")?.classList.remove("focus");
|
this.shadow.querySelector(".parcours>.focus")?.classList.remove("focus");
|
||||||
event.currentTarget.classList.add("focus");
|
event.currentTarget.classList.add("focus");
|
||||||
|
let divCompetences = this.shadow.querySelector(".competences");
|
||||||
|
|
||||||
/* Récupère une liste plate de toutes les compentences de toutes les années */
|
|
||||||
let bucketCompetences = [
|
|
||||||
Object.keys(this.data.parcours[
|
|
||||||
Object.keys(this.data.parcours)[0]
|
|
||||||
].annees[1].competences)
|
|
||||||
, Object.keys(this.data.parcours[cle].annees[2].competences)
|
|
||||||
, Object.keys(this.data.parcours[cle].annees[3].competences)
|
|
||||||
].flat();
|
|
||||||
|
|
||||||
/* Compte le nombre d'occurence de chaque compétence */
|
|
||||||
let competences = {};
|
|
||||||
bucketCompetences.forEach(competence => {
|
|
||||||
competences[competence] = ++competences[competence] || 1
|
|
||||||
})
|
|
||||||
|
|
||||||
/* Affichage */
|
|
||||||
let numComp = 1;
|
|
||||||
this.shadow.querySelector(".competences").innerHTML = "";
|
this.shadow.querySelector(".competences").innerHTML = "";
|
||||||
Object.entries(competences).forEach(([competence, nb]) => {
|
|
||||||
var divCompetence3ans = document.createElement("div");
|
Object.entries(this.data.parcours[cle].annees).forEach(([annee, dataAnnee]) => {
|
||||||
divCompetence3ans.className = "competence";
|
Object.entries(dataAnnee.competences).forEach(([competence, niveauCle]) => {
|
||||||
let numTmp = numComp;
|
let numComp = this.competencesNumber[competence];
|
||||||
for (let i = 0; i < nb; i++) {
|
|
||||||
let divCompetence = document.createElement("div");
|
let divCompetence = document.createElement("div");
|
||||||
divCompetence.innerText = `${competence} ${i + 1}`;
|
divCompetence.innerText = `${competence} ${niveauCle.niveau}`;
|
||||||
divCompetence.className = "comp" + numTmp;
|
divCompetence.style.gridRowStart = annee;
|
||||||
divCompetence.addEventListener("click", (event) => { this.AC(event, competence, numTmp, i + 1) })
|
divCompetence.style.gridColumnStart = competence;
|
||||||
divCompetence3ans.appendChild(divCompetence);
|
divCompetence.className = "comp" + numComp;
|
||||||
}
|
divCompetence.dataset.competence = `${competence} ${niveauCle.niveau}`;
|
||||||
this.shadow.querySelector(".competences").appendChild(divCompetence3ans);
|
divCompetence.addEventListener("click", (event) => { this.AC(event, competence, niveauCle.niveau, annee, numComp) })
|
||||||
numComp++;
|
divCompetences.appendChild(divCompetence);
|
||||||
})
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
/* Réaffectation des focus */
|
||||||
|
this.shadow.querySelectorAll(".AC").forEach(ac => {
|
||||||
|
this.shadow.querySelector(`[data-competence="${ac.dataset.competence}"]`).classList.add("focus");
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
AC(event, competence, numComp, annee) {
|
AC(event, competence, niveau, annee, numComp) {
|
||||||
event.currentTarget.classList.toggle("focus");
|
event.currentTarget.classList.toggle("focus");
|
||||||
if (this.shadow.querySelector(`[data-competence="${competence} ${annee}"]`)) {
|
if (this.shadow.querySelector(`.ACs [data-competence="${competence} ${niveau}"]`)) {
|
||||||
this.shadow.querySelector(`[data-competence="${competence} ${annee}"]`).remove();
|
this.shadow.querySelector(`.ACs [data-competence="${competence} ${niveau}"]`).remove();
|
||||||
} else {
|
} else {
|
||||||
let output = `
|
let output = `
|
||||||
<ul class=AC data-competence="${competence} ${annee}">
|
<ul class=AC data-competence="${competence} ${niveau}">
|
||||||
<h2 class=comp${numComp}>${competence} ${annee}</h2>
|
<h2 class=comp${numComp}>${competence} ${niveau}</h2>
|
||||||
`;
|
`;
|
||||||
Object.entries(this.data.competences[competence].niveaux["BUT" + annee].app_critiques).forEach(([num, contenu]) => {
|
Object.entries(this.data.competences[competence].niveaux["BUT" + annee].app_critiques).forEach(([num, contenu]) => {
|
||||||
output += `<li><div class=comp${numComp}>${num}</div><div>${contenu.libelle}</div></li>`;
|
output += `<li><div class=comp${numComp}>${num}</div><div>${contenu.libelle}</div></li>`;
|
||||||
})
|
})
|
||||||
this.shadow.querySelector(".ACs").innerHTML += output + "</ul>";
|
this.shadow.querySelector(".ACs").innerHTML += output + "</ul>";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
customElements.define('ref-competences', ref_competences);
|
customElements.define('ref-competences', ref_competences);
|
Loading…
Reference in New Issue
Block a user