-
Notifications
You must be signed in to change notification settings - Fork 39
Expand file tree
/
Copy pathmilestone-anomaly.model.ts
More file actions
40 lines (31 loc) · 1.03 KB
/
milestone-anomaly.model.ts
File metadata and controls
40 lines (31 loc) · 1.03 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
import { Anomaly } from './anomaly.model';
import { Milestone } from './milestone.model';
export abstract class MilestoneAnomaly extends Anomaly {
readonly anomalyType = 'MilestoneAnomaly';
constructor(anomaly: string) {
super(anomaly);
}
}
// Represents an anomaly that is related to a single milestone
export class SingleMilestoneAnomaly extends MilestoneAnomaly {
milestone: Milestone;
constructor(milestone: Milestone, anomaly: string) {
super(anomaly);
this.milestone = milestone;
}
getDescription(): string {
return `${this.milestone.title}: ${this.anomaly}`;
}
}
// Represents an anomaly that is related to multiple milestones
export class GeneralMilestoneAnomaly extends MilestoneAnomaly {
milestones: Milestone[];
constructor(milestones: Milestone[], anomaly: string) {
super(anomaly);
this.milestones = milestones;
}
getDescription(): string {
const milestoneTitles = this.milestones.map((milestone) => milestone.title).join(', ');
return `${this.anomaly}: ${milestoneTitles}`;
}
}