Moved calendar to utils, added course type td

This commit is contained in:
Thomas Forgione 2017-09-25 18:39:34 +00:00
parent 944ba2fb03
commit 19a99622a2
No known key found for this signature in database
GPG Key ID: 95D964F74A96119E
2 changed files with 11 additions and 6 deletions

View File

@ -1,4 +1,4 @@
const cal = require('./calendar'); const cal = require('calendar');
function computeUserTable(user, callback) { function computeUserTable(user, callback) {

View File

@ -20,10 +20,11 @@ function fromIcal(string) {
} }
cal.Type = { cal.Type = {
TP: 1, TD: 1,
CTD: 2, TP: 2,
CM: 3, CTD: 3,
Other: 4, CM: 4,
Other: 5,
} }
cal.getTypeName = function(type) { cal.getTypeName = function(type) {
@ -37,7 +38,9 @@ cal.getTypeName = function(type) {
cal.getFactor = function(type) { cal.getFactor = function(type) {
switch (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.CTD: return 1.25;
case cal.Type.CM: return 1.5; case cal.Type.CM: return 1.5;
default: return 0; default: return 0;
@ -62,6 +65,8 @@ cal.Event = class {
this.type = cal.Type.CTD; this.type = cal.Type.CTD;
} else if (this.name.indexOf("TP") !== -1) { } else if (this.name.indexOf("TP") !== -1) {
this.type = cal.Type.TP; this.type = cal.Type.TP;
} else if (this.name.indexOf("TD") !== -1) {
this.type = cal.Type.TD;
} else if (this.name.indexOf("CM") !== -1) { } else if (this.name.indexOf("CM") !== -1) {
this.type = cal.Type.CM; this.type = cal.Type.CM;
} }