From 104375f4051bcc4f75796de3d7ebb42fed0016ad Mon Sep 17 00:00:00 2001 From: mauricioAndrey Date: Mon, 10 Nov 2025 16:18:22 -0300 Subject: [PATCH] feat(Enrollment.ts): adding average attribute and its method --- server/src/models/Enrollment.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/server/src/models/Enrollment.ts b/server/src/models/Enrollment.ts index 26488ff9..d82936f3 100644 --- a/server/src/models/Enrollment.ts +++ b/server/src/models/Enrollment.ts @@ -4,10 +4,12 @@ import { Evaluation } from './Evaluation'; export class Enrollment { private student: Student; private evaluations: Evaluation[]; + private average: GLfloat; - constructor(student: Student, evaluations: Evaluation[] = []) { + constructor(student: Student, evaluations: Evaluation[] = [], average: GLfloat = 0) { this.student = student; this.evaluations = evaluations; + this.average = average; } // Get student @@ -20,6 +22,10 @@ export class Enrollment { return [...this.evaluations]; // Return copy to prevent external modification } + getAverage(): GLfloat{ + return this.average; + } + // Add or update an evaluation addOrUpdateEvaluation(goal: string, grade: 'MANA' | 'MPA' | 'MA'): void { const existingIndex = this.evaluations.findIndex(evaluation => evaluation.getGoal() === goal);