This might work with APP

This commit is contained in:
Thomas Forgione 2017-11-14 15:17:05 +01:00
parent 8bb72a6e22
commit 4c635fa9bb
No known key found for this signature in database
GPG Key ID: C75CD416BD1FFCE1
1 changed files with 7 additions and 2 deletions

View File

@ -28,8 +28,9 @@ cal.Type = {
BE: 5,
Examen: 6,
Projet: 7,
APP: 8,
},
Unknown: 8,
Unknown: 9,
}
cal.getTypeName = function(type) {
@ -41,6 +42,7 @@ cal.getTypeName = function(type) {
case cal.Type.Other.BE:
case cal.Type.Other.Projet:
case cal.Type.Other.Examen:
case cal.Type.Other.APP:
return "Other";
default: return "Unknown";
}
@ -53,6 +55,7 @@ cal.getFactor = function(type) {
case cal.Type.Other.BE: return 1;
case cal.Type.Other.Projet: return 1;
case cal.Type.Other.Examen: return 0;
case cal.Type.Other.APP: return 1.5;
case cal.Type.CTD: return 1.25;
case cal.Type.CM: return 1.5;
default: return 0;
@ -75,6 +78,8 @@ cal.getTypeFromName = function(name) {
return cal.Type.Other.Examen;
} else if (name.toLowerCase().indexOf("projet") !== -1) {
return cal.Type.Other.Projet;
} else if (name.indexOf("APP") !== -1) {
return cal.Type.Other.APP;
} else {
return cal.Type.Unkown;
}
@ -290,7 +295,7 @@ cal.getTotalByCourse = function(user, callback) {
let type = event.type;
let typeName;
if (type === cal.Type.Other.BE || type == cal.Type.Other.Examen || type == cal.Type.Other.Projet) {
if (type in cal.Type.Other) {
typeName = "Other";
} else {
typeName = cal.getTypeName(type);