Corrected bugs

This commit is contained in:
Thomas Forgione 2017-10-03 14:32:30 +02:00
parent 64e1316b1e
commit 7fdd5be753
No known key found for this signature in database
GPG Key ID: C75CD416BD1FFCE1
1 changed files with 12 additions and 2 deletions

View File

@ -28,7 +28,7 @@ cal.Type = {
BE: 5,
Examen: 6,
},
Unkown: 7,
Unknown: 7,
}
cal.getTypeName = function(type) {
@ -71,7 +71,10 @@ cal.getTypeFromName = function(name) {
return cal.Type.Other.BE;
} else if (name.indexOf("Examen") !== -1) {
return cal.Type.Other.Examen;
} else {
return cal.Type.Unkown;
}
}
cal.Event = class {
@ -281,7 +284,14 @@ cal.getTotalByCourse = function(user, callback) {
res[name].totalTdEquivalent = 0;
}
res[name][cal.getTypeName(event.type)]++;
let type = event.type;
let typeName;
if (type === cal.Type.Other.BE || type == cal.Type.Other.Examen) {
typeName = "Other";
} else {
typeName = cal.getTypeName(type);
}
res[name][typeName]++;
res[name].totalTdEquivalent += event.getTdEquivalent();
}