diff options
Diffstat (limited to 'src/graduation-common.ts')
| -rw-r--r-- | src/graduation-common.ts | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/graduation-common.ts b/src/graduation-common.ts index 3c90e34..6ef0031 100644 --- a/src/graduation-common.ts +++ b/src/graduation-common.ts @@ -119,6 +119,7 @@ class Graduation { green: number = 0; orange: number = 0; red: number = 0; + nettoPoints: number = 0; mandatory: number = 0; level: number = 1; changes: Array<GraduationChange> = []; @@ -147,13 +148,17 @@ class Graduation { switch (change.change) { case "GrĂ¼n": this.green++; + this.nettoPoints++; break; case "Orange": this.orange++; + if (this.nettoPoints > 0) this.nettoPoints--; break; case "Rot": + if (this.nettoPoints > 3) this.nettoPoints -= 2; + else this.nettoPoints = 0; this.red++; break; @@ -163,6 +168,7 @@ class Graduation { this.green = 0; this.orange = 0; this.red = 0; + this.nettoPoints = 0; break; case "CoachZuweisung": @@ -189,6 +195,7 @@ class Graduation { this.green = 0; this.orange = 0; this.red = 0; + this.nettoPoints = 0; this.mandatory = 0; this.level = 1; this.changes = []; @@ -216,9 +223,13 @@ class Graduation { /** * Return the combined value of all points. + * + * Negative values are not possible. Positive points earned after any negativ + * points always count. Two consecutive orange points followed by a single + * green point will result in one netto point. */ getNettoPoints(): number { - return this.green - this.orange - this.red * 2; + return this.nettoPoints; } } |
