{"size": 1078, "ext": "js", "max_stars_repo_path": "src/school/Day.js", "max_stars_repo_name": "ViktorTrojan/GlatzBot", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/school/Day.js", "max_issues_repo_name": "ViktorTrojan/GlatzBot", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/school/Day.js", "max_forks_repo_name": "ViktorTrojan/GlatzBot", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 28.3684210526, "max_line_length": 149, "alphanum_fraction": 0.5705009276}
class Lesson {
    constructor(subject, teacher, time, duration = 50) {
        this.subject = subject;
        this.teacher = teacher;
        this.duration = duration;

        this.startTime = new Date();
        let t = this.convertTime(time);
        this.startTime.setHours(t[0], t[1], 0, 0);
        this.endTime = new Date();
        this.endTime.setHours(t[0], t[1] + this.duration, 0, 0);
    }

    convertTime(time) {
        const split = time.split(":");
        let hour = parseInt(split[0]);
        let minute = parseInt(split[1]);
        return [hour, minute];
    }
}

class Day {
    constructor() {
        this.initLessons();
    }

    getLessonAtTime(date) {
        if (date.getTime() < this.lessons[0].startTime.getTime() || date.getTime() > this.lessons[this.lessons.length - 1].endTime.getTime()) return;

        for (let lesson of this.lessons) {
            if (date.getTime() >= lesson.startTime.getTime() && date.getTime() <= lesson.endTime.getTime()) return lesson;
        }

        return "break";
    }
}

module.exports = { Lesson, Day };