-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathSubmission.ts
More file actions
48 lines (40 loc) · 1.08 KB
/
Submission.ts
File metadata and controls
48 lines (40 loc) · 1.08 KB
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
42
43
44
45
46
47
48
export class Submission {
private _date: string;
private _phase: number;
private _score: number;
private _rubric: string;
private _graceDaysUsed: number;
constructor(date: string, phase: number, score: number, rubric: string, graceDaysUsed: number) {
this._date = date;
this._phase = phase;
this._score = score;
this._rubric = rubric;
this._graceDaysUsed = graceDaysUsed;
}
get date(): string {
return this._date;
}
get phase(): number {
return this._phase;
}
get score(): number {
return this._score;
}
get rubric(): string {
return this._rubric;
}
get graceDaysUsed(): number {
return this._graceDaysUsed;
}
static fromJson(json: JSON): Submission {
interface SubmissionJson {
_date: string;
_phase: number;
_score: number;
_rubric: string;
_graceDaysUsed: number;
}
const jsonObject: SubmissionJson = json as unknown as SubmissionJson;
return new Submission(jsonObject._date, jsonObject._phase, jsonObject._score, jsonObject._rubric, jsonObject._graceDaysUsed);
}
}