From 19a99622a22dfc46a3a100a24bf80d58b2683423 Mon Sep 17 00:00:00 2001 From: Thomas Forgione Date: Mon, 25 Sep 2017 18:39:34 +0000 Subject: [PATCH] Moved calendar to utils, added course type td --- controllers/total/views.js | 2 +- {controllers/total => utils}/calendar.js | 15 ++++++++++----- 2 files changed, 11 insertions(+), 6 deletions(-) rename {controllers/total => utils}/calendar.js (96%) diff --git a/controllers/total/views.js b/controllers/total/views.js index bb918d1..d75f4bb 100644 --- a/controllers/total/views.js +++ b/controllers/total/views.js @@ -1,4 +1,4 @@ -const cal = require('./calendar'); +const cal = require('calendar'); function computeUserTable(user, callback) { diff --git a/controllers/total/calendar.js b/utils/calendar.js similarity index 96% rename from controllers/total/calendar.js rename to utils/calendar.js index ffbd5e3..cbb59c5 100644 --- a/controllers/total/calendar.js +++ b/utils/calendar.js @@ -20,10 +20,11 @@ function fromIcal(string) { } cal.Type = { - TP: 1, - CTD: 2, - CM: 3, - Other: 4, + TD: 1, + TP: 2, + CTD: 3, + CM: 4, + Other: 5, } cal.getTypeName = function(type) { @@ -37,7 +38,9 @@ cal.getTypeName = function(type) { cal.getFactor = function(type) { switch (type) { - case cal.Type.TP: return 1; + case cal.Type.TP: + case cal.Type.TD: + return 1; case cal.Type.CTD: return 1.25; case cal.Type.CM: return 1.5; default: return 0; @@ -62,6 +65,8 @@ cal.Event = class { 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; }