From 04a3ad04f36773ded45dbed60a86a4fb124247d7 Mon Sep 17 00:00:00 2001 From: Justus Dieckmann Date: Thu, 5 Oct 2023 17:20:24 +0200 Subject: [PATCH] CI: Update for Moodle 4.3 --- .github/workflows/moodle-ci.yml | 11 +++++++---- locallib.php | 18 +++++++++--------- renderer.php | 28 ++++++++++++++-------------- 3 files changed, 30 insertions(+), 27 deletions(-) diff --git a/.github/workflows/moodle-ci.yml b/.github/workflows/moodle-ci.yml index f793c641..5ae01946 100644 --- a/.github/workflows/moodle-ci.yml +++ b/.github/workflows/moodle-ci.yml @@ -8,8 +8,8 @@ jobs: strategy: matrix: - php: ['8.1'] - moodle-branch: ['MOODLE_402_STABLE'] + php: ['8.2'] + moodle-branch: ['MOODLE_403_STABLE'] database: ['pgsql'] steps: @@ -108,9 +108,12 @@ jobs: strategy: fail-fast: false matrix: - php: ['8.0', '8.1'] - moodle-branch: ['MOODLE_401_STABLE', 'MOODLE_402_STABLE'] + php: ['8.0', '8.1', '8.2'] + moodle-branch: ['MOODLE_401_STABLE', 'MOODLE_402_STABLE', 'MOODLE_403_STABLE'] database: ['mariadb', 'pgsql'] + exclude: + - php: '8.2' + moodle-branch: 'MOODLE_401_STABLE' include: - php: '7.4' moodle-branch: 'MOODLE_39_STABLE' diff --git a/locallib.php b/locallib.php index e88685ab..615d0e70 100644 --- a/locallib.php +++ b/locallib.php @@ -1207,25 +1207,25 @@ public function handle_view() { $choicestatus->accesstimestart = $this->ratingallocate->accesstimestart; $choicestatus->accesstimestop = $this->ratingallocate->accesstimestop; $choicestatus->publishdate = $this->ratingallocate->publishdate; - $choicestatus->is_published = $this->ratingallocate->published; - $choicestatus->available_choices = $this->get_rateable_choices(); + $choicestatus->ispublished = $this->ratingallocate->published; + $choicestatus->availablechoices = $this->get_rateable_choices(); // Filter choices to display by groups, where 'usegroups' is true. - $choicestatus->available_choices = $this->filter_choices_by_groups($choicestatus->available_choices, $USER->id); + $choicestatus->availablechoices = $this->filter_choices_by_groups($choicestatus->availablechoices, $USER->id); $strategysettings = $this->get_strategy_class()->get_static_settingfields(); if (array_key_exists(ratingallocate\strategy_order\strategy::COUNTOPTIONS, $strategysettings)) { - $choicestatus->necessary_choices = + $choicestatus->necessarychoices = $strategysettings[ratingallocate\strategy_order\strategy::COUNTOPTIONS][2]; } else { - $choicestatus->necessary_choices = 0; + $choicestatus->necessarychoices = 0; } - $choicestatus->own_choices = $this->get_rating_data_for_user($USER->id); + $choicestatus->ownchoices = $this->get_rating_data_for_user($USER->id); // Filter choices to display by groups, where 'usegroups' is true. - $choicestatus->own_choices = $this->filter_choices_by_groups($choicestatus->own_choices, $USER->id); + $choicestatus->ownchoices = $this->filter_choices_by_groups($choicestatus->ownchoices, $USER->id); $choicestatus->allocations = $this->get_allocations_for_user($USER->id); $choicestatus->strategy = $this->get_strategy_class(); - $choicestatus->show_distribution_info = has_capability('mod/ratingallocate:start_distribution', $this->context); - $choicestatus->show_user_info = has_capability('mod/ratingallocate:give_rating', $this->context, null, false); + $choicestatus->showdistributioninfo = has_capability('mod/ratingallocate:start_distribution', $this->context); + $choicestatus->showuserinfo = has_capability('mod/ratingallocate:give_rating', $this->context, null, false); $choicestatus->algorithmstarttime = $this->ratingallocate->algorithmstarttime; $choicestatus->algorithmstatus = $this->get_algorithm_status(); $choicestatusoutput = $renderer->render($choicestatus); diff --git a/renderer.php b/renderer.php index 2f68d6a6..a792df32 100644 --- a/renderer.php +++ b/renderer.php @@ -112,14 +112,14 @@ public function render_ratingallocate_choice_status(ratingallocate_choice_status $t->data[] = $row; } } - if ($status->is_published && $status->publishdate) { + if ($status->ispublished && $status->publishdate) { $this->add_table_row_tuple($t, get_string('publishdate', RATINGALLOCATE_MOD_NAME), userdate($status->publishdate)); } else if ($status->publishdate) { $this->add_table_row_tuple($t, get_string('publishdate_estimated', RATINGALLOCATE_MOD_NAME), userdate($status->publishdate)); } - if ($status->show_distribution_info && $status->accesstimestop < $time) { + if ($status->showdistributioninfo && $status->accesstimestop < $time) { // Print algorithm status and last run time. if ($status->algorithmstarttime) { $this->add_table_row_tuple($t, get_string('last_algorithm_run_date', RATINGALLOCATE_MOD_NAME), @@ -132,12 +132,12 @@ public function render_ratingallocate_choice_status(ratingallocate_choice_status } // Print own choices or full list of available choices. - if (!empty($status->own_choices) && $status->show_user_info && $accesstimestart < $time) { + if (!empty($status->ownchoices) && $status->showuserinfo && $accesstimestart < $time) { $row = new html_table_row(); $cell1 = new html_table_cell(get_string('your_rating', RATINGALLOCATE_MOD_NAME)); $choiceshtml = array(); - foreach ($status->own_choices as $choice) { + foreach ($status->ownchoices as $choice) { array_push($choiceshtml, format_string($choice->title) . ' (' . s($this->get_option_title($choice->rating, $status->strategy)) . ')'); } @@ -148,12 +148,12 @@ public function render_ratingallocate_choice_status(ratingallocate_choice_status $cell2 ); $t->data[] = $row; - } else if (!empty($status->available_choices)) { + } else if (!empty($status->availablechoices)) { $row = new html_table_row(); $cell1 = new html_table_cell(get_string('rateable_choices', RATINGALLOCATE_MOD_NAME)); $choiceshtml = array(); - foreach ($status->own_choices as $choice) { + foreach ($status->ownchoices as $choice) { array_push($choiceshtml, format_string($choice->title)); } @@ -167,14 +167,14 @@ public function render_ratingallocate_choice_status(ratingallocate_choice_status $hasrating = false; // Check if the user has rated at least one choice. - foreach ($status->own_choices as $choice) { + foreach ($status->ownchoices as $choice) { if (object_property_exists($choice, 'ratingid') && $choice->ratingid != null) { $hasrating = true; break; } } - if ($status->is_published) { + if ($status->ispublished) { if (!empty($status->allocations)) { $row = new html_table_row(); $cell1 = new html_table_cell( @@ -189,7 +189,7 @@ public function render_ratingallocate_choice_status(ratingallocate_choice_status $cell2 = new html_table_cell($allocationhtml); $row->cells = array($cell1, $cell2); $t->data[] = $row; - } else if (!empty($status->own_choices)) { + } else if (!empty($status->ownchoices)) { // Only print warning that user is not allocated if she has any rating. if ($hasrating) { $row = new html_table_row(); @@ -209,11 +209,11 @@ public function render_ratingallocate_choice_status(ratingallocate_choice_status $o .= $this->output->box_end(); // Notifications if no choices exist or too few in comparison to strategy settings. - if (empty($status->available_choices)) { + if (empty($status->availablechoices)) { $this->add_notification(get_string('no_choice_to_rate', RATINGALLOCATE_MOD_NAME)); - } else if ($status->necessary_choices > count($status->available_choices)) { - if ($status->show_distribution_info) { - $this->add_notification(get_string('too_few_choices_to_rate', RATINGALLOCATE_MOD_NAME, $status->necessary_choices)); + } else if ($status->necessarychoices > count($status->availablechoices)) { + if ($status->showdistributioninfo) { + $this->add_notification(get_string('too_few_choices_to_rate', RATINGALLOCATE_MOD_NAME, $status->necessarychoices)); } } @@ -222,7 +222,7 @@ public function render_ratingallocate_choice_status(ratingallocate_choice_status $this->add_notification(get_string('too_early_to_rate', RATINGALLOCATE_MOD_NAME), 'notifymessage'); } else if ($status->accesstimestop < $time) { // Too late to rate. // If results already published. - if ($status->is_published == true) { + if ($status->ispublished == true) { if (count($status->allocations) > 0) { $this->add_notification(get_string('rating_is_over_with_allocation', RATINGALLOCATE_MOD_NAME, array_pop($status->allocations)->title), 'notifysuccess');