From 19cb3b4697a9c99ae1b480019c671309866cd923 Mon Sep 17 00:00:00 2001 From: EllMoorby <99148447+EllMoorby@users.noreply.github.com> Date: Sun, 12 Jul 2026 16:12:21 +0100 Subject: [PATCH] fix: count manual final scores towards module progress --- app/models/uni_module.rb | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/app/models/uni_module.rb b/app/models/uni_module.rb index df597f1..1aa8b87 100644 --- a/app/models/uni_module.rb +++ b/app/models/uni_module.rb @@ -48,12 +48,6 @@ def correct_weight_sum? exams.sum(:weight) == 100 end - def progress(user) - return 100 if final_score.present? - - exams_with_results(user).sum(:weight) - end - # Gets the average score of all of the completed exams so far, weighted by credits def weighted_average(user) valid_exams = exams_with_results(user) @@ -72,12 +66,13 @@ def achieved_score(user) # Gets the percentage completion of the module based on the exams taken def completion_percentage(user) - return 0 unless exams.exists? return 100 if final_score.present? exams_with_results(user).sum(:weight) end + alias progress completion_percentage + def target(user) target = UniModuleTarget.find_by(user: user, uni_module: self) return nil if target.nil? || target.score.nil?