From d0975a6e7ee57de4debda94e823011d813fbf4a1 Mon Sep 17 00:00:00 2001 From: Furkan Sahin Date: Sun, 5 Sep 2021 21:39:24 -0500 Subject: Initial rewrite in svelte --- src/models/Lab.ts | 45 ++++++++++++++++++++++++++++----------------- 1 file changed, 28 insertions(+), 17 deletions(-) (limited to 'src/models/Lab.ts') diff --git a/src/models/Lab.ts b/src/models/Lab.ts index a6972ef..8636f74 100644 --- a/src/models/Lab.ts +++ b/src/models/Lab.ts @@ -1,23 +1,34 @@ -import EventInfo from '@/models/EventInfo'; +import type EventInfo from "./EventInfo"; export default class Lab { - course: number; + id: number; + course: number; + section: number; + event: EventInfo; + building: string; + room: string; - section: number; + 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); + } - event: EventInfo; + this.id = parseInt(`${course}${section}`, 10); + this.course = course; + this.section = section; + this.event = event; + this.building = building; + this.room = room; + } - constructor(course = 0, section = 0, event = new EventInfo()) { - this.course = course; - this.section = section; - this.event = event; - } + get time() { + return this.event.info; + } - get id() { - return `${this.course}-${this.section}`; - } - - get fullInfo() { - return `${this.id} ${this.event.info}`; - } -} + get location() { + return `${this.building}-${this.room}`; + } +} \ No newline at end of file -- cgit v1.2.3