From 3e31f5fea563a6d8e0092e67915739f82006b178 Mon Sep 17 00:00:00 2001 From: Furkan Sahin Date: Tue, 31 May 2022 07:31:29 -0500 Subject: Add bool to track whether a lab is assigned or not --- src/models/Lab.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/models/Lab.ts b/src/models/Lab.ts index d23cffb..91cf3c9 100644 --- a/src/models/Lab.ts +++ b/src/models/Lab.ts @@ -1,3 +1,4 @@ +import { assign } from "svelte/internal"; import EventInfo from "./EventInfo"; interface LabSerializeInfo { @@ -9,7 +10,8 @@ interface LabSerializeInfo { end: number }, building: string, - room: string + room: string, + assigned: boolean } export default class Lab { @@ -19,12 +21,13 @@ export default class Lab { event: EventInfo; building: string; room: string; + assigned: boolean; - constructor(course: number | string, section: number | string, event: EventInfo, building = "", room = "") { - if(typeof course === "string") { + constructor(course: number | string, section: number | string, event: EventInfo, building = "", room = "", assigned = false) { + if (typeof course === "string") { course = parseInt(course, 10); } - if(typeof section === "string") { + if (typeof section === "string") { section = parseInt(section, 10); } @@ -34,10 +37,11 @@ export default class Lab { this.event = event; this.building = building; this.room = room; + this.assigned = assigned; } - static fromJSON({course, section, event, building, room}: LabSerializeInfo) { - return new Lab(course, section, EventInfo.fromJSON(event), building, room); + static fromJSON({ course, section, event, building, room, assigned }: LabSerializeInfo) { + return new Lab(course, section, EventInfo.fromJSON(event), building, room, assigned); } get time() { -- cgit v1.2.3