SZTE/specdata.js

68 lines
1.8 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

class SubjectData {
constructor(id, name, credit, categories) {
this.id = id;
this.name = name;
this.credit = credit;
this.categories = categories;
this.grade = 0;
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;
}
}
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);