Skip to content

Commit 094e599

Browse files
author
Laur0r
authored
Merge pull request #231 from justusdieckmann/update/m40
Update for Moodle 4.0
2 parents a5bea7b + e557748 commit 094e599

15 files changed

+115
-69
lines changed

.github/workflows/moodle-ci.yml

+7-7
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ jobs:
99
strategy:
1010
matrix:
1111
php: ['7.4']
12-
moodle-branch: ['MOODLE_311_STABLE']
12+
moodle-branch: ['MOODLE_400_STABLE']
1313
database: ['pgsql']
1414

1515
steps:
1616
- name: Start PostgreSQL
17-
run: docker run -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_HOST_AUTH_METHOD=trust -d postgres:9.6
17+
run: docker run -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_HOST_AUTH_METHOD=trust -d postgres:10
1818

1919
- name: Check out repository code
2020
uses: actions/checkout@v2
@@ -108,18 +108,18 @@ jobs:
108108
strategy:
109109
fail-fast: false
110110
matrix:
111-
php: ['7.3', '7.4']
112-
moodle-branch: ['MOODLE_39_STABLE', 'MOODLE_310_STABLE', 'MOODLE_311_STABLE']
111+
php: ['7.4']
112+
moodle-branch: ['MOODLE_39_STABLE', 'MOODLE_310_STABLE', 'MOODLE_311_STABLE', 'MOODLE_400_STABLE']
113113
database: ['mariadb', 'pgsql']
114114

115115
steps:
116116
- name: Start MariaDB
117117
if: matrix.database == 'mariadb'
118-
run: docker run -p 3306:3306 -e MYSQL_USER=root -e MYSQL_ALLOW_EMPTY_PASSWORD=true -d mariadb:10.5
118+
run: docker run -p 3306:3306 -e MYSQL_USER=root -e MYSQL_ALLOW_EMPTY_PASSWORD=true -d mariadb:10
119119

120120
- name: Start PostgreSQL
121121
if: matrix.database == 'pgsql'
122-
run: docker run -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_HOST_AUTH_METHOD=trust -d postgres:9.6
122+
run: docker run -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_HOST_AUTH_METHOD=trust -d postgres:10
123123

124124
- name: Check out repository code
125125
uses: actions/checkout@v2
@@ -171,4 +171,4 @@ jobs:
171171

172172
- name: Behat features
173173
if: ${{ always() }}
174-
run: moodle-plugin-ci behat --profile chrome
174+
run: moodle-plugin-ci behat --profile chrome --auto-rerun 0

.github/workflows/moodle-release.yml

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#
2+
# Whenever a new tag starting with "v" is pushed, add the tagged version
3+
# to the Moodle Plugins directory at https://moodle.org/plugins
4+
#
5+
# revision: 2021070201
6+
# Changed to be released on Github release with the release notes.
7+
#
8+
name: Releasing in the Plugins directory
9+
10+
on:
11+
release:
12+
types: [published]
13+
14+
defaults:
15+
run:
16+
shell: bash
17+
18+
jobs:
19+
release-at-moodle-org:
20+
runs-on: ubuntu-latest
21+
env:
22+
PLUGIN: mod_ratingallocate
23+
CURL: curl -s
24+
ENDPOINT: https://moodle.org/webservice/rest/server.php
25+
TOKEN: ${{ secrets.MOODLE_ORG_TOKEN }}
26+
FUNCTION: local_plugins_add_version
27+
28+
steps:
29+
- name: Call the service function
30+
id: add-version
31+
run: |
32+
TAGNAME="${{ github.event.release.tag_name }}"
33+
BODY="${{ github.event.release.body }}"
34+
ZIPURL="${{ github.event.release.zipball_url }}"
35+
RESPONSE=$(${CURL} ${ENDPOINT} --data-urlencode "wstoken=${TOKEN}" \
36+
--data-urlencode "wsfunction=${FUNCTION}" \
37+
--data-urlencode "moodlewsrestformat=json" \
38+
--data-urlencode "frankenstyle=${PLUGIN}" \
39+
--data-urlencode "zipurl=${ZIPURL}" \
40+
--data-urlencode "vcssystem=git" \
41+
--data-urlencode "vcsrepositoryurl=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}" \
42+
--data-urlencode "vcstag=${TAGNAME}" \
43+
--data-urlencode "changelogurl=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/commits/${TAGNAME}" \
44+
--data-urlencode "altdownloadurl=${ZIPURL}" \
45+
--data-urlencode "releasenotes=${BODY}" \
46+
--data-urlencode "releasenotesformat=4")
47+
echo "::set-output name=response::${RESPONSE}"
48+
- name: Evaluate the response
49+
id: evaluate-response
50+
env:
51+
RESPONSE: ${{ steps.add-version.outputs.response }}
52+
run: |
53+
jq <<< ${RESPONSE}
54+
jq --exit-status ".id" <<< ${RESPONSE} > /dev/null

amd/build/radiobuttondeselect.min.js

+10-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

amd/build/radiobuttondeselect.min.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

amd/src/radiobuttondeselect.js

-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
* This class manages the deselection of radiobuttons, which is necessary for deleting allocations
1818
*
1919
* @module mod_ratingallocate/radiobuttondeselect
20-
* @class radiobuttondeselect
21-
* @package mod_ratingallocate
2220
* @copyright 2017 Tobias Reischmann
2321
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
2422
*/

lib.php

+6
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@
5353
* @return mixed true if the feature is supported, null if unknown
5454
*/
5555
function ratingallocate_supports($feature) {
56+
if (defined('FEATURE_MOD_PURPOSE')) {
57+
if ($feature == FEATURE_MOD_PURPOSE) {
58+
return MOD_PURPOSE_ADMINISTRATION;
59+
}
60+
}
61+
5662
switch ($feature) {
5763
case FEATURE_MOD_INTRO :
5864
return true;

pix/monologo.svg

+1
Loading

tests/behat/allocation_status.feature

+8-17
Original file line numberDiff line numberDiff line change
@@ -21,61 +21,52 @@ Feature: Students should get status information according to their rating and th
2121
| activity | course | idnumber | name | accesstimestart |
2222
| ratingallocate | C1 | ra1 | My Fair Allocation | ##yesterday## |
2323
And I log in as "teacher1"
24-
And I am on "Course 1" course homepage with editing mode on
25-
And I follow "My Fair Allocation"
24+
And I am on the "My Fair Allocation" "ratingallocate activity" page
2625
And I press "Edit Choices"
2726
And I add a new choice with the values:
2827
| title | My only choice |
2928
| Description (optional) | Test |
3029
| maxsize | 1 |
3130
And I log out
3231
And I log in as "student1"
33-
And I am on "Course 1" course homepage
34-
And I follow "My Fair Allocation"
32+
And I am on the "My Fair Allocation" "ratingallocate activity" page
3533
And I press "Edit Rating"
3634
And I press "Save changes"
3735
And I log out
3836
And I log in as "student2"
39-
And I am on "Course 1" course homepage
40-
And I follow "My Fair Allocation"
37+
And I am on the "My Fair Allocation" "ratingallocate activity" page
4138
And I press "Edit Rating"
4239
And I click on "Deny" "radio"
4340
And I press "Save changes"
4441
And I log out
4542
And I log in as "teacher1"
46-
And I am on "Course 1" course homepage
47-
And I follow "My Fair Allocation"
48-
And I navigate to "Edit settings" in current page administration
43+
And I am on the "My Fair Allocation" "ratingallocate activity editing" page
4944
And I set the following fields to these values:
5045
| Rating begins at | ##2 days ago## |
5146
| Rating ends at | ##yesterday## |
5247
And I press "id_submitbutton"
5348
And I run the scheduled task "mod_ratingallocate\task\cron_task"
54-
And I am on "Course 1" course homepage
55-
And I follow "My Fair Allocation"
49+
And I am on the "My Fair Allocation" "ratingallocate activity" page
5650
And I press "Publish Allocation"
5751
And I log out
5852

5953
@javascript
6054
Scenario: As a user, who rated and was allocated, I should see my allocated choice.
6155
When I log in as "student1"
62-
And I am on "Course 1" course homepage
63-
And I follow "My Fair Allocation"
56+
And I am on the "My Fair Allocation" "ratingallocate activity" page
6457
Then I should see "My only choice" in the "//*[contains(@class, 'allocation')]" "xpath_element"
6558
And I should see "My only choice" in the "//*[contains(@class, 'alert-success')]" "xpath_element"
6659

6760
@javascript
6861
Scenario: As a user, who rated and was not allocated, I should see a warning.
6962
When I log in as "student2"
70-
And I am on "Course 1" course homepage
71-
And I follow "My Fair Allocation"
63+
And I am on the "My Fair Allocation" "ratingallocate activity" page
7264
Then I should see "You were not allocated to any choice!" in the "//*[contains(@class, 'allocation')]" "xpath_element"
7365
And I should see "You could not be allocated to any choice." in the "//*[contains(@class, 'alert-danger')]" "xpath_element"
7466

7567
@javascript
7668
Scenario: As a user, who did not rate, I should not see my allocated choice
7769
When I log in as "student3"
78-
And I am on "Course 1" course homepage
79-
And I follow "My Fair Allocation"
70+
And I am on the "My Fair Allocation" "ratingallocate activity" page
8071
Then I should not see "Your Allocation"
8172
And I should see "The rating is over." in the "//*[contains(@class, 'alert-info')]" "xpath_element"

tests/behat/behat_mod_ratingallocate.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -541,7 +541,7 @@ public function i_rate_choices_with_the_following_points(TableNode $ratingdata)
541541
$ratingdatehash = $ratingdata->getRowsHash();
542542
// The action depends on the field type.
543543
foreach ($ratingdatehash as $choice => $value) {
544-
$fieldxpath = "//legend[normalize-space(.)=\"$choice\"]/ancestor::fieldset/descendant::input[@type='text']";
544+
$fieldxpath = "//*[contains(text(), '$choice')]/ancestor::fieldset/descendant::input[@type='text']";
545545
try {
546546
$option = $this->find('xpath', $fieldxpath);
547547
$option->setValue($value);

0 commit comments

Comments
 (0)