aboutsummaryrefslogtreecommitdiff
path: root/src/models/PeerTeacher.ts
blob: f3874311cc5cd732b4ffa965835d73aa35187ee9 (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
35
36
37
38
39
40
41
import EventInfo from './EventInfo';

export default class PeerTeacher {
  firstname: string;

  lastname: string;

  uin: number;

  events: EventInfo[];

  assignedLabs: Set<string>;

  constructor(firstname = '', lastname = '', uin = 0) {
    this.firstname = firstname;
    this.lastname = lastname;
    this.uin = uin;
    this.events = [];
    this.assignedLabs = new Set();
  }

  conflictsWith(event: EventInfo) {
    let conflicts = false;
    this.events.every((item) => {
      if (item.conflictsWith(event)) {
        conflicts = true;
        return false;
      }
      return true;
    });
    return conflicts;
  }

  get name() {
    return `${this.firstname} ${this.lastname}`;
  }

  get id() {
    return this.uin;
  }
}