parent
fabbae223e
commit
64e1316b1e
|
@ -7,11 +7,20 @@ table.table.table-bordered.table-striped.table-hover
|
|||
th Total TD equivalent
|
||||
tbody
|
||||
each course in courses
|
||||
tr
|
||||
tr(class=course.totalTdEquivalent === 0 ? "no-courses" : "")
|
||||
td #{course.name}
|
||||
each type in types
|
||||
td #{course[type]}
|
||||
td #{course.totalTdEquivalent}
|
||||
tr#extend
|
||||
td
|
||||
a(href="#") ...
|
||||
each type in types
|
||||
td
|
||||
a(href="#") ...
|
||||
td
|
||||
a(href="#") ...
|
||||
|
||||
tr.table-active
|
||||
td
|
||||
strong #{total.name}
|
||||
|
@ -25,3 +34,4 @@ p.
|
|||
If you think there is a mistake in this table, feel free to
|
||||
<a href="https://github.com/tforgione/adejs/issues/new">open an issue</a>
|
||||
exaplaining what are the problem so we can fix it. Thanks!
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ function computeUserTableByCourse(user, callback) {
|
|||
courses.push(item);
|
||||
}
|
||||
|
||||
result.courses = courses;
|
||||
result.courses = courses.sort((a,b) => -(a.totalTdEquivalent - b.totalTdEquivalent));
|
||||
result.total = total;
|
||||
|
||||
callback(result);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
let loadingDiv = document.getElementById('loading');
|
||||
let errorDiv = document.getElementById('error');
|
||||
let resultDiv = document.getElementById('result');
|
||||
var loadingDiv = document.getElementById('loading');
|
||||
var errorDiv = document.getElementById('error');
|
||||
var resultDiv = document.getElementById('result');
|
||||
const timeout = 10000;
|
||||
|
||||
function getTable() {
|
||||
|
@ -27,6 +27,32 @@ function setData(text) {
|
|||
loadingDiv.style.display = "none";
|
||||
errorDiv.style.display = "none";
|
||||
resultDiv.innerHTML = text;
|
||||
|
||||
var emptyCourses = document.getElementsByClassName('no-courses');
|
||||
if (emptyCourses.length === 0) {
|
||||
showEmptyCourses();
|
||||
} else {
|
||||
hideEmptyCourses();
|
||||
document.getElementById('extend').addEventListener('click', function() {
|
||||
showEmptyCourses();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function showEmptyCourses() {
|
||||
var emptyCourses = document.getElementsByClassName('no-courses');
|
||||
for (var i = 0; i < emptyCourses.length; i++) {
|
||||
emptyCourses[i].style.display = "";
|
||||
}
|
||||
document.getElementById('extend').style.display = "none";
|
||||
}
|
||||
|
||||
function hideEmptyCourses() {
|
||||
var emptyCourses = document.getElementsByClassName('no-courses');
|
||||
for (var i = 0; i < emptyCourses.length; i++) {
|
||||
emptyCourses[i].style.display = "none";
|
||||
}
|
||||
document.getElementById('extend').style.display = "";
|
||||
}
|
||||
|
||||
function setError() {
|
||||
|
|
|
@ -20,22 +20,27 @@ function fromIcal(string) {
|
|||
}
|
||||
|
||||
cal.Type = {
|
||||
TD: 1,
|
||||
TP: 2,
|
||||
BE: 3,
|
||||
CTD: 4,
|
||||
CM: 5,
|
||||
Other: 6,
|
||||
CM: 1,
|
||||
CTD: 2,
|
||||
TD: 3,
|
||||
TP: 4,
|
||||
Other: {
|
||||
BE: 5,
|
||||
Examen: 6,
|
||||
},
|
||||
Unkown: 7,
|
||||
}
|
||||
|
||||
cal.getTypeName = function(type) {
|
||||
switch (type) {
|
||||
case cal.Type.TD: return "TD";
|
||||
case cal.Type.TP: return "TP";
|
||||
case cal.Type.CTD: return "CTD";
|
||||
case cal.Type.CM: return "CM";
|
||||
case cal.Type.BE: return "BE";
|
||||
default: return "Other";
|
||||
case cal.Type.TD: return "TD";
|
||||
case cal.Type.TP: return "TP";
|
||||
case cal.Type.CTD: return "CTD";
|
||||
case cal.Type.CM: return "CM";
|
||||
case cal.Type.Other.BE:
|
||||
case cal.Type.Other.Examen:
|
||||
return "Other";
|
||||
default: return "Unknown";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -43,7 +48,8 @@ cal.getFactor = function(type) {
|
|||
switch (type) {
|
||||
case cal.Type.TD:
|
||||
case cal.Type.TP:
|
||||
case cal.Type.BE:
|
||||
case cal.Type.Other.BE:
|
||||
case cal.Type.Other.Examen:
|
||||
return 1;
|
||||
case cal.Type.CTD: return 1.25;
|
||||
case cal.Type.CM: return 1.5;
|
||||
|
@ -51,6 +57,23 @@ cal.getFactor = function(type) {
|
|||
}
|
||||
}
|
||||
|
||||
cal.getTypeFromName = function(name) {
|
||||
|
||||
if (name.indexOf("CTD") !== -1) {
|
||||
return cal.Type.CTD;
|
||||
} else if (name.indexOf("TP") !== -1) {
|
||||
return cal.Type.TP;
|
||||
} else if (name.indexOf("TD") !== -1) {
|
||||
return cal.Type.TD;
|
||||
} else if (name.indexOf("CM") !== -1) {
|
||||
return cal.Type.CM;
|
||||
} else if (name.indexOf("BE") !== -1) {
|
||||
return cal.Type.Other.BE;
|
||||
} else if (name.indexOf("Examen") !== -1) {
|
||||
return cal.Type.Other.Examen;
|
||||
}
|
||||
}
|
||||
|
||||
cal.Event = class {
|
||||
|
||||
constructor(content, firstLineIndex = 0) {
|
||||
|
@ -58,24 +81,14 @@ cal.Event = class {
|
|||
this.finishTime = undefined;
|
||||
this.name = undefined;
|
||||
this.location = undefined;
|
||||
this.type = cal.Type.Other;
|
||||
this.type = cal.Type.Unkown;
|
||||
|
||||
if (content !== undefined)
|
||||
this.setFromContent(content, firstLineIndex);
|
||||
}
|
||||
|
||||
guessTypeFromName() {
|
||||
if (this.name.indexOf("CTD") !== -1) {
|
||||
this.type = cal.Type.CTD;
|
||||
} else if (this.name.indexOf("TP") !== -1) {
|
||||
this.type = cal.Type.TP;
|
||||
} else if (this.name.indexOf("TD") !== -1) {
|
||||
this.type = cal.Type.TD;
|
||||
} else if (this.name.indexOf("CM") !== -1) {
|
||||
this.type = cal.Type.CM;
|
||||
} else if (this.name.indexOf("BE") !== -1) {
|
||||
this.type = cal.Type.BE;
|
||||
}
|
||||
this.type = cal.getTypeFromName(this.name);
|
||||
}
|
||||
|
||||
getDurationInHours() {
|
||||
|
|
Loading…
Reference in New Issue