From 7e6d7cfce98cd1a34fe0d5354101e15e35c75da2 Mon Sep 17 00:00:00 2001 From: Justus Dieckmann Date: Thu, 27 Apr 2023 13:40:04 +0200 Subject: [PATCH 1/6] CI: Update for Moodle 4.2 --- .github/workflows/moodle-ci.yml | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/moodle-ci.yml b/.github/workflows/moodle-ci.yml index 550e31e2..f793c641 100644 --- a/.github/workflows/moodle-ci.yml +++ b/.github/workflows/moodle-ci.yml @@ -8,8 +8,8 @@ jobs: strategy: matrix: - php: ['8.0'] - moodle-branch: ['MOODLE_401_STABLE'] + php: ['8.1'] + moodle-branch: ['MOODLE_402_STABLE'] database: ['pgsql'] steps: @@ -108,8 +108,8 @@ jobs: strategy: fail-fast: false matrix: - php: ['8.0'] - moodle-branch: ['MOODLE_311_STABLE', 'MOODLE_400_STABLE', 'MOODLE_401_STABLE'] + php: ['8.0', '8.1'] + moodle-branch: ['MOODLE_401_STABLE', 'MOODLE_402_STABLE'] database: ['mariadb', 'pgsql'] include: - php: '7.4' @@ -118,6 +118,18 @@ jobs: - php: '7.4' moodle-branch: 'MOODLE_39_STABLE' database: 'pgsql' + - php: '8.0' + moodle-branch: 'MOODLE_311_STABLE' + database: 'mariadb' + - php: '8.0' + moodle-branch: 'MOODLE_311_STABLE' + database: 'pgsql' + - php: '8.0' + moodle-branch: 'MOODLE_400_STABLE' + database: 'mariadb' + - php: '8.0' + moodle-branch: 'MOODLE_400_STABLE' + database: 'pgsql' steps: - name: Start MariaDB From eff37579e23f1bee5549d25bd6e580bfd2c20802 Mon Sep 17 00:00:00 2001 From: Justus Dieckmann Date: Thu, 27 Apr 2023 15:03:53 +0200 Subject: [PATCH 2/6] Prevent json_decode(null); Use plain text area in behat tests --- classes/ratings_and_allocations_table.php | 3 ++- tests/behat/mod_form.feature | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/classes/ratings_and_allocations_table.php b/classes/ratings_and_allocations_table.php index 64fea794..80eb2fd0 100644 --- a/classes/ratings_and_allocations_table.php +++ b/classes/ratings_and_allocations_table.php @@ -419,7 +419,8 @@ private function print_hidden_user_fields($users) { */ private function setup_filter($hidenorating = null, $showallocnecessary = null) { // Get the filter settings. - $filter = json_decode(get_user_preferences('flextable_' . $this->uniqueid . '_filter'), true); + $settings = get_user_preferences('flextable_' . $this->uniqueid . '_filter'); + $filter = $settings ? json_decode($settings, true) : null; if (!$filter) { $filter = array( diff --git a/tests/behat/mod_form.feature b/tests/behat/mod_form.feature index 3e99a3aa..225f0fdd 100644 --- a/tests/behat/mod_form.feature +++ b/tests/behat/mod_form.feature @@ -32,6 +32,7 @@ Feature: Creating a new rating allocation, where new choices need to | title | My third choice | | Description (optional) | Test 3 | | maxsize | 2 | + And the default editor is set to "textarea" Scenario: Create a new rating alloation and add an additonal new choice. Given I add a new choice with the values: From bdfe725fd58e4d6d4d4f77db7b8623d9a24569ab Mon Sep 17 00:00:00 2001 From: Justus Dieckmann Date: Mon, 1 May 2023 21:27:13 +0200 Subject: [PATCH 3/6] Remove duplicate add choice button and unnecessary notification close icon --- renderer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/renderer.php b/renderer.php index 38c59c46..400ccdca 100644 --- a/renderer.php +++ b/renderer.php @@ -255,7 +255,7 @@ public function format_text($text) { * @param $classes string class for the formatting of the notification */ public function add_notification($note, $classes = 'notifyproblem') { - array_push($this->notifications, $this->notification($note, $classes)); + array_push($this->notifications, $this->notification($note, $classes, false)); } /** From cba9dcdce012bdea679d9713c209d31ab665ee06 Mon Sep 17 00:00:00 2001 From: Justus Dieckmann Date: Mon, 1 May 2023 21:28:04 +0200 Subject: [PATCH 4/6] Rename table download file names --- classes/allocations_table.php | 2 +- classes/ratings_and_allocations_table.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/classes/allocations_table.php b/classes/allocations_table.php index b310ed15..4a760bfb 100644 --- a/classes/allocations_table.php +++ b/classes/allocations_table.php @@ -49,7 +49,7 @@ public function __construct($ratingallocate) { $this->ratingallocate = $ratingallocate; if (has_capability('mod/ratingallocate:export_ratings', $ratingallocate->get_context())) { $download = optional_param('download', '', PARAM_ALPHA); - $this->is_downloading($download, $ratingallocate->ratingallocate->name, 'Testsheet'); + $this->is_downloading($download, $ratingallocate->ratingallocate->name . '-allocations', 'allocations'); } } diff --git a/classes/ratings_and_allocations_table.php b/classes/ratings_and_allocations_table.php index 80eb2fd0..39763dfb 100644 --- a/classes/ratings_and_allocations_table.php +++ b/classes/ratings_and_allocations_table.php @@ -68,7 +68,7 @@ public function __construct(\mod_ratingallocate_renderer $renderer, $titles, $ra $this->ratingallocate = $ratingallocate; if ($downloadable && has_capability('mod/ratingallocate:export_ratings', $ratingallocate->get_context())) { $download = optional_param('download', '', PARAM_ALPHA); - $this->is_downloading($download, 'Test', 'Testsheet'); + $this->is_downloading($download, $ratingallocate->ratingallocate->name . '-ratings_and_allocations', 'ratings_and_allocations'); } $this->shownames = true; From 4eeffa141ed105b291305fce8ce7ddfa78dc297c Mon Sep 17 00:00:00 2001 From: Justus Dieckmann Date: Mon, 1 May 2023 21:28:55 +0200 Subject: [PATCH 5/6] Remove unused function --- renderer.php | 42 ------------------------------------------ 1 file changed, 42 deletions(-) diff --git a/renderer.php b/renderer.php index 400ccdca..8a044a5b 100644 --- a/renderer.php +++ b/renderer.php @@ -766,48 +766,6 @@ private function get_option_title($rating, strategytemplate $strategy) { get_string('rating_raw', RATINGALLOCATE_MOD_NAME, $option); } - /** - * Format the users in the rating table - */ - public function format_user_data($data) { - global $CFG, $USER, $COURSE; - - $output = ''; - $output .= html_writer::start_tag('div', array('class' => 'ratingallocate_user')); - $output .= html_writer::start_tag('div', array('class' => 'name')); - $output .= fullname($data); - $output .= html_writer::end_tag('div'); - $output .= html_writer::start_tag('div', array('class' => 'icons')); - if (has_capability('moodle/user:viewdetails', $this->page->context)) { - $a = array(); - $a['href'] = new moodle_url('/user/view.php', array('id' => $data->id, 'course' => $COURSE->id)); - $a['title'] = get_string('viewprofile', 'core'); - $output .= html_writer::start_tag('a', $a); - - $src = array('src' => $this->output->pix_url('i/user'), 'class' => 'icon', 'alt' => get_string('viewprofile', 'core')); - $output .= html_writer::empty_tag('img', $src); - - $output .= html_writer::end_tag('a'); - } - - if ($CFG->messaging && has_capability('moodle/site:sendmessage', $this->page->context) && $data->id != $USER->id) { - $a = array(); - $a['href'] = new moodle_url('/message/index.php', array('id' => $data->id)); - $a['title'] = get_string('sendmessageto', 'core_message', fullname($data)); - $output .= html_writer::start_tag('a', $a); - - $src = array('src' => $this->output->pix_url('t/email'), 'class' => 'icon'); - $src['alt'] = get_string('sendmessageto', 'core_message', fullname($data)); - $output .= html_writer::empty_tag('img', $src); - - $output .= html_writer::end_tag('a'); - } - $output .= html_writer::end_tag('div'); - $output .= html_writer::end_tag('div'); - - return $output; - } - /** * Utility function to add a row of data to a table with 2 columns. Modified * the table param and does not return a value From 46da1774bd3d30e8bf2e8f25f9b12a5436c584b0 Mon Sep 17 00:00:00 2001 From: Justus Dieckmann Date: Tue, 2 May 2023 15:54:00 +0200 Subject: [PATCH 6/6] Bump version --- .github/workflows/moodle-release.yml | 2 +- version.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/moodle-release.yml b/.github/workflows/moodle-release.yml index bf585047..555a34bf 100644 --- a/.github/workflows/moodle-release.yml +++ b/.github/workflows/moodle-release.yml @@ -44,7 +44,7 @@ jobs: --data-urlencode "altdownloadurl=${ZIPURL}" \ --data-urlencode "releasenotes=${BODY}" \ --data-urlencode "releasenotesformat=4") - echo "::set-output name=response::${RESPONSE}" + echo "response=${RESPONSE}" >> $GITHUB_OUTPUT - name: Evaluate the response id: evaluate-response env: diff --git a/version.php b/version.php index 9bd21077..8960a063 100644 --- a/version.php +++ b/version.php @@ -28,5 +28,5 @@ $plugin->version = 2023050900; // The current module version (Date: YYYYMMDDXX) $plugin->requires = 2020061500; // Requires Moodle 3.9+. $plugin->maturity = MATURITY_STABLE; -$plugin->release = 'v4.0-r1'; +$plugin->release = 'v4.2-r1'; $plugin->component = 'mod_ratingallocate'; // To check on upgrade, that module sits in correct place