Commit bedd6f6a authored by BERTHAUT Florent's avatar BERTHAUT Florent
Browse files

Sorted UE then EC

parent 4b48075e
This diff is collapsed.
......@@ -194,9 +194,29 @@ function parseGuides(fiches) {
guid.set(f["Semestre"], []);
}
//fill the specialisation/year/semester with UE info
//add the fiche fill to the specialisation/year/semester
let sem = guid.get(f["Semestre"]);
sem.push(f);
sem.push(JSON.parse(JSON.stringify(f)));
//change UE number depending on parcours for L3
if(f["Année"]=="L3" && (guideName=="L3 TCI" || guideName=="L3 MPT")) {
if(f["Semestre"]==5 && f["UE"]==7 && f["Parcours"].split(",").length>1) { //Stages
console.log("In "+guideName);
sem[sem.length-1]["UE"]=5;
console.log("Changing fiche ", sem[sem.length-1]);
}
else if(f["UE"]==4 && (f["Nom UE"]+"").includes("anglais")) {
sem[sem.length-1]["UE"]=3;
}
else if(f["UE"]==5 && (f["Nom UE"]+"").includes("LV2")) {
sem[sem.length-1]["UE"]=4;
}
else if(f["UE"]==6 && (f["Nom UE"]+"").includes("LV3")) {
sem[sem.length-1]["UE"]=5;
}
}
}
}
......@@ -206,18 +226,25 @@ function parseGuides(fiches) {
for(let semStr of guid.keys()) {
console.log("Semestre "+semStr);
let sem = guid.get(semStr);
//sort according to UE/EC
sem.sort(function(a,b) {
if(a["UE"]<b["UE"]) {
if(a["UE"]<b["UE"]
|| (a["UE"]==b["UE"]
&& a["Nom EC"][0]<b["Nom EC"][0])) {
return -1;
}
else if(a["UE"]>b["UE"]) {
else if(a["UE"]>b["UE"]
|| (a["UE"]==b["UE"]
&& a["Nom EC"][0]>b["Nom EC"][0])) {
return 1;
}
return 0;
});
for(let ue of sem) {
console.log(ue["UE"]+" "+ue["Nom UE"]+" "+ue["Nom EC"]);
if(guideName=="L3 TCI") {
for(let ue of sem) {
console.log(ue["UE"]+" "+ue["Nom UE"]+" "+ue["Nom EC"]);
}
}
}
}
......@@ -229,6 +256,35 @@ function addLine(guide, row, label, suffix) {
guide.str += "\n\n";
}
function filterField(field) {
let fieldText = field;
//remove (MPT/TCI) if needed
if(fieldText.endsWith("(MPT/TCI)")) {
fieldText = fieldText.substr(0, fieldText.length-9);
}
//remove extra lines of type (<p><br /></p>)
fieldText = fieldText.replace(/<p><br \/><\/p>/g, "");
//remove span for lang
fieldText = fieldText.replace(/<span*>/g, "");
fieldText = fieldText.replace(/<\/span>/g, "");
//remove last <br/> if there is one
if(fieldText.endsWith("<br />")) {
fieldText = fieldText.substr(0, fieldText.length-6);
}
//add a br if the field ends with a list
if(fieldText.endsWith("/ul>")) {
fieldText += "&nbsp";
}
return fieldText;
}
function writeFilteredFicheToStr(guide, guideName, f) {
let guidFilt = guidesFilters.get(guideName);
if(guidFilt==undefined) {
......@@ -251,8 +307,8 @@ function writeFilteredFicheToStr(guide, guideName, f) {
guide.str += " - Semestre "+f["Semestre"]+"</i>\n";
guide.str += "<p>\n";
guide.str += "<span custom-style='Titre 1 Car1'>S"+f["Semestre"]+" ";
guide.str += "UE "+f["UE"]+"&nbsp;: </span> ";
//guide.str += "<span custom-style='Titre 1 Car1'>S"+f["Semestre"]+" ";
guide.str += "<span custom-style='Titre 1 Car1'>UE "+f["UE"]+"&nbsp;: </span> ";
guide.str += "<span custom-style='Titre 1 Car1'>"+f["Nom UE"]+"</span>\n";
guide.str += "</p>\n";
guide.str += "<p>&nbsp</p>\n";
......@@ -261,8 +317,19 @@ function writeFilteredFicheToStr(guide, guideName, f) {
let titleSuf = "&nbsp;: </span> ";
let fieldSuf = "</p>\n";
guide.str += titlePre+ "Enseignement" + titleSuf;
guide.str += f["Nom EC"]
if(f["Année"]=="L1"
&& (f["UE"]==1 || f["UE"]==5 || f["UE"]==6 )) {
let parcSplit = f["Parcours"].split(" ");
guide.str += titlePre+ "Parcours "+parcSplit[0]+"-"+parcSplit[1]+"</span>";
guide.str += fieldSuf;
}
guide.str += titlePre+ "Enseignement" + titleSuf;
guide.str += filterField(f["Nom EC"]);
guide.str += fieldSuf;
guide.str += titlePre+ "Enseignant.e.s" + titleSuf;
guide.str += filterField(f["Enseignant.e.s"]);
guide.str += fieldSuf;
guide.str += titlePre+ "Volume horaire" + titleSuf;
......@@ -278,20 +345,29 @@ function writeFilteredFicheToStr(guide, guideName, f) {
}
guide.str += fieldSuf;
guide.str += titlePre+ "Pré-requis" + titleSuf;
guide.str += filterField(f["Prérequis"])
guide.str += fieldSuf;
/*
["Enseignant.e.s", ["Enseignant.e.s"]],
["Volume horaire", ["Volume horaire encadré", "h ",
"(", "Heures CM", "h CM / ", "Heures TD", "h TD)"]],
["Pré-requis", ["Prérequis"]],
["Compétence(s) visée(s)", ["Compétence(s) visée(s)"]],
["Descriptif du cours", ["Descriptif"]],
["Évaluation", ["Informations sur l'évaluation"]],
["Langue d'enseignement", ["Langue d'enseignement"]],
["Bibliographie sélective", ["Bibliographie sélective"]]
*/
guide.str += titlePre+ "Compétence(s) visée(s)" + titleSuf;
guide.str += filterField(f["Compétence(s) visée(s)"]);
guide.str += fieldSuf;
guide.str += titlePre+ "Descriptif du cours" + titleSuf;
guide.str += filterField(f["Descriptif"]);
guide.str += fieldSuf;
guide.str += titlePre+ "Évaluation" + titleSuf;
guide.str += filterField(f["Informations sur l'évaluation"]);
guide.str += fieldSuf;
guide.str += titlePre+ "Langue d'enseignement" + titleSuf;
guide.str += filterField(f["Langue d'enseignement"]);
guide.str += fieldSuf;
guide.str += titlePre+ "Bibliographie sélective" + titleSuf;
guide.str += filterField(f["Bibliographie sélective"]);
guide.str += fieldSuf;
/*
for(let destField of guidFilt.keys()) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment