From 775d654955801185da41e150238717c1cc43e8d5 Mon Sep 17 00:00:00 2001 From: Riedler Date: Thu, 20 Feb 2025 18:51:36 +0100 Subject: [PATCH 1/2] fix: Module state priority we now prioritize grades if one exists in determining a module's status. while this hasn't caused any obvious bugs so far, it might be the cause of a bug report we received in user feedback --- lbplanner/classes/helpers/modules_helper.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lbplanner/classes/helpers/modules_helper.php b/lbplanner/classes/helpers/modules_helper.php index fa03f56e..34093eb9 100644 --- a/lbplanner/classes/helpers/modules_helper.php +++ b/lbplanner/classes/helpers/modules_helper.php @@ -139,8 +139,9 @@ public static function determine_type(int $cmid): int { public static function get_module_status(module $module, int $userid, ?int $planid = null): int { global $DB; - if ($planid === null) { - $planid = plan_helper::get_plan_id($userid); + $grade = $module->get_grade($userid); + if ($grade !== null && $grade !== MODULE_GRADE::RIP) { + return MODULE_STATUS::DONE; } // Getting some necessary data. @@ -158,13 +159,12 @@ public static function get_module_status(module $module, int $userid, ?int $plan return MODULE_STATUS::UPLOADED; } } + + // Check if the module is late. - $grade = $module->get_grade($userid); - - if ($grade !== null && $grade !== MODULE_GRADE::RIP) { - return MODULE_STATUS::DONE; + if ($planid === null) { + $planid = plan_helper::get_plan_id($userid); } - // Check if the module is late. $deadline = $module->get_deadline($planid); From 89043b96e37c409494129b01157e6f36c4351648 Mon Sep 17 00:00:00 2001 From: Riedler Date: Thu, 20 Feb 2025 19:12:44 +0100 Subject: [PATCH 2/2] style: appease code checker --- lbplanner/classes/helpers/modules_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lbplanner/classes/helpers/modules_helper.php b/lbplanner/classes/helpers/modules_helper.php index 34093eb9..d5b4768f 100644 --- a/lbplanner/classes/helpers/modules_helper.php +++ b/lbplanner/classes/helpers/modules_helper.php @@ -159,7 +159,7 @@ public static function get_module_status(module $module, int $userid, ?int $plan return MODULE_STATUS::UPLOADED; } } - + // Check if the module is late. if ($planid === null) {