diff options
| author | Furkan Sahin <furkan-dev@proton.me> | 2022-05-31 07:31:29 -0500 |
|---|---|---|
| committer | Furkan Sahin <furkan-dev@proton.me> | 2022-05-31 07:31:29 -0500 |
| commit | 3e31f5fea563a6d8e0092e67915739f82006b178 (patch) | |
| tree | 106a2363f0f0f8b8712537bbb766a1cd64ce9971 /src/models | |
| parent | d1af70f8e35358fcdc8f224ef9bf2de28d2887f4 (diff) | |
Add bool to track whether a lab is assigned or not
Diffstat (limited to 'src/models')
| -rw-r--r-- | src/models/Lab.ts | 16 |
1 files 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() { |
