From 7fdd5be7533473a93150577723de0a85944cfed4 Mon Sep 17 00:00:00 2001 From: Thomas Forgione Date: Tue, 3 Oct 2017 14:32:30 +0200 Subject: [PATCH] Corrected bugs --- utils/calendar.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/utils/calendar.js b/utils/calendar.js index 80638d5..5617747 100644 --- a/utils/calendar.js +++ b/utils/calendar.js @@ -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(); }