aboutsummaryrefslogtreecommitdiff
path: root/src/models/Lab.ts
blob: 8636f7411414978613e6d5ff81930066b006c0e0 (plain)
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
import type EventInfo from "./EventInfo";

export default class Lab {
    id: number;
    course: number;
    section: number;
    event: EventInfo;
    building: string;
    room: string;

    constructor(course: number | string, section: number | string, event: EventInfo, building = "", room = "") {
        if(typeof course === "string") {
            course = parseInt(course, 10);
        }
        if(typeof section === "string") {
            section = parseInt(section, 10);
        }

        this.id = parseInt(`${course}${section}`, 10);
        this.course = course;
        this.section = section;
        this.event = event;
        this.building = building;
        this.room = room;
    }

    get time() {
        return this.event.info;
    }

    get location() {
        return `${this.building}-${this.room}`;
    }
}