This repository has been archived by the owner on Feb 18, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlocals.js
106 lines (98 loc) · 2.89 KB
/
locals.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
const ics = require("ics");
const icsHelper = require("./icsHelper.js");
const { writeFileSync, exists } = require("fs");
const initLecture = lecturename => {
const lecture = require(`./api/lectures/${lecturename}/base.json`);
if (lecture.maincontent !== null) {
if (lecture.maincontent.lecture !== null) {
lecture.maincontent.lecture.lectures = require(`./api/lectures/${lecturename}/lectures.json`);
}
if (lecture.maincontent.lab !== null) {
lecture.maincontent.lab.labs = require(`./api/lectures/${lecturename}/labs.json`);
}
exists(`./api/lectures/${lecturename}/dates.json`, ex => {
if (ex) {
lecture.dates = require(`./api/lectures/${lecturename}/dates.json`);
}
if (lecture.maincontent.lecture !== null) {
// generate ics
const icsObjects = icsHelper.mkIcsObjs(lecture);
const { error, value } = ics.createEvents(icsObjects);
if (error) {
console.log(error);
}
writeFileSync(`${__dirname}/ics/${lecturename}.ics`, value);
}
return lecture;
});
}
return lecture;
};
const algdati = initLecture("algdati"); // require('./api/lectures/algdati.json')
const algdatii = initLecture("algdatii"); // require('./api/lectures/algdatii.json')
const compiler = initLecture("compiler"); // require('./api/lectures/compiler.json')
const fun = initLecture("fun"); // require('./api/lectures/fun.json')
const sa = initLecture("sa"); // require('./api/lectures/sa.json')
const seiib = initLecture("seiib"); // require('./api/lectures/seiib.json')
const seiiib = initLecture("seiiib"); // require('./api/lectures/seiiib.json')
const swengiib = initLecture("swengiib"); // require('./api/lectures/swengiib.json')
const swengiiib = initLecture("swengiiib"); // require('./api/lectures/swengiiib.json')
const vss = initLecture("vss"); // require('./api/lectures/vss.json')
const webtech = initLecture("webtech"); // require('./api/lectures/webtech.json')
const webtechFK12 = initLecture("webtechFK12"); // require('./api/lectures/webtechFK12.json')
const base = require("./api/base.json");
const lectures = [
algdati,
algdatii,
compiler,
fun,
sa,
seiib,
seiiib,
swengiib,
swengiiib,
vss,
webtech,
webtechFK12
];
exports.lectures = lectures;
exports.currentSemester = {
short: "WS 19/20",
long: "Wintersemester 2019/20",
lectures: [algdati, vss],
next: {
short: "SS 20",
lectures: [algdatii, fun, vss]
},
semesters: [
{
filter: ".ws1920",
label: "WS 19/20"
},
{
filter: ".ss19",
label: "SS 19"
},
{
filter: ".ws1819",
label: "WS 18/19"
},
{
filter: ".ss18",
label: "SS 18"
},
// {
// filter: ".ws1718",
// label: "WS 17/18"
// },
// {
// filter: ".ss17",
// label: "SS 17"
// },
{
filter: ".older",
label: "DAVOR"
}
]
};
exports.base = base;