SZTE/specdata.js

68 lines
1.8 KiB
JavaScript
Raw Normal View History

class SubjectData {
constructor(id, name, credit, categories) {
this.id = id;
this.name = name;
this.credit = credit;
this.categories = categories;
2021-01-04 16:01:58 +00:00
this.grade = 0;
2021-01-25 17:43:05 +00:00
this.semester = 0;
}
}
class SubjectCategory {
constructor(id, name, neededCredit) {
this.id = id;
this.name = name;
this.spec = null;
this.neededCredit = neededCredit;
}
}
class Specialization {
constructor(id, name, matcat, infcat) {
this.id = id;
this.name = name;
this.matcat = matcat;
matcat.spec = this;
this.infcat = infcat;
infcat.spec = this;
}
}
2021-01-25 17:43:05 +00:00
class Semester {
constructor(firstYear, num) {
this.firstYear = firstYear;
this.num = num;
}
static parse(str) {
const regex = /(\d{4})\/\d{2}\/(\d)/g.exec(str);
return new Semester(+regex[1], +regex[2]);
}
static current() {
const date = new Date();
const year = date.getFullYear();
const month = date.getMonth();
const s = new Semester(year, 1);
if (month === 0)
s.firstYear--;
else if (month < 8) {
s.firstYear--;
s.num++;
}
return s;
}
}
const kotMatCat = new SubjectCategory("MKALA", "Kötelező matekos tárgyak", 46);
const kotInfCat = new SubjectCategory("MKSZT", "Kötelező infós tárgyak", 52);
kotSpec = new Specialization("KOT", "Kötelező tárgyak", kotMatCat, kotInfCat);
const kotvalMatCat = new SubjectCategory("MKDIFMATSZT", "Kötvál matekos tárgyak", 14);
const kotvalInfCat = new SubjectCategory("MKDIFINF", "Kötvál infós tárgyak", 23);
kotvalSpec = new Specialization("MK-DIF", "Specializáció nélkül", kotvalMatCat, kotvalInfCat);
kotvalEgyebCat = new SubjectCategory("MKDIFFEGYEB", "Kötvál egyéb tárgyak");
szakdogaCat = new SubjectCategory("MKSZD", "Szakdolgozat", 20);
szakmaiCat = new SubjectCategory("MKSZG", "Szakmai gyakorlat", 0);
szabvalCat = new SubjectCategory("MKSZV", "Szabadon választható tárgyak", 10);