Skip to content

Commit

Permalink
Merge pull request #231 from justusdieckmann/update/m40
Browse files Browse the repository at this point in the history
Update for Moodle 4.0
  • Loading branch information
Laur0r committed Aug 30, 2022
2 parents a5bea7b + e557748 commit 094e599
Show file tree
Hide file tree
Showing 15 changed files with 115 additions and 69 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/moodle-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ jobs:
strategy:
matrix:
php: ['7.4']
moodle-branch: ['MOODLE_311_STABLE']
moodle-branch: ['MOODLE_400_STABLE']
database: ['pgsql']

steps:
- name: Start PostgreSQL
run: docker run -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_HOST_AUTH_METHOD=trust -d postgres:9.6
run: docker run -p 5432:5432 -e POSTGRES_USER=postgres -e POSTGRES_HOST_AUTH_METHOD=trust -d postgres:10

- name: Check out repository code
uses: actions/checkout@v2
Expand Down Expand Up @@ -108,18 +108,18 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ['7.3', '7.4']
moodle-branch: ['MOODLE_39_STABLE', 'MOODLE_310_STABLE', 'MOODLE_311_STABLE']
php: ['7.4']
moodle-branch: ['MOODLE_39_STABLE', 'MOODLE_310_STABLE', 'MOODLE_311_STABLE', 'MOODLE_400_STABLE']
database: ['mariadb', 'pgsql']

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

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

- name: Check out repository code
uses: actions/checkout@v2
Expand Down Expand Up @@ -171,4 +171,4 @@ jobs:

- name: Behat features
if: ${{ always() }}
run: moodle-plugin-ci behat --profile chrome
run: moodle-plugin-ci behat --profile chrome --auto-rerun 0
54 changes: 54 additions & 0 deletions .github/workflows/moodle-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#
# Whenever a new tag starting with "v" is pushed, add the tagged version
# to the Moodle Plugins directory at https://moodle.org/plugins
#
# revision: 2021070201
# Changed to be released on Github release with the release notes.
#
name: Releasing in the Plugins directory

on:
release:
types: [published]

defaults:
run:
shell: bash

jobs:
release-at-moodle-org:
runs-on: ubuntu-latest
env:
PLUGIN: mod_ratingallocate
CURL: curl -s
ENDPOINT: https://moodle.org/webservice/rest/server.php
TOKEN: ${{ secrets.MOODLE_ORG_TOKEN }}
FUNCTION: local_plugins_add_version

steps:
- name: Call the service function
id: add-version
run: |
TAGNAME="${{ github.event.release.tag_name }}"
BODY="${{ github.event.release.body }}"
ZIPURL="${{ github.event.release.zipball_url }}"
RESPONSE=$(${CURL} ${ENDPOINT} --data-urlencode "wstoken=${TOKEN}" \
--data-urlencode "wsfunction=${FUNCTION}" \
--data-urlencode "moodlewsrestformat=json" \
--data-urlencode "frankenstyle=${PLUGIN}" \
--data-urlencode "zipurl=${ZIPURL}" \
--data-urlencode "vcssystem=git" \
--data-urlencode "vcsrepositoryurl=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}" \
--data-urlencode "vcstag=${TAGNAME}" \
--data-urlencode "changelogurl=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/commits/${TAGNAME}" \
--data-urlencode "altdownloadurl=${ZIPURL}" \
--data-urlencode "releasenotes=${BODY}" \
--data-urlencode "releasenotesformat=4")
echo "::set-output name=response::${RESPONSE}"
- name: Evaluate the response
id: evaluate-response
env:
RESPONSE: ${{ steps.add-version.outputs.response }}
run: |
jq <<< ${RESPONSE}
jq --exit-status ".id" <<< ${RESPONSE} > /dev/null
12 changes: 10 additions & 2 deletions amd/build/radiobuttondeselect.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion amd/build/radiobuttondeselect.min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions amd/src/radiobuttondeselect.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
* This class manages the deselection of radiobuttons, which is necessary for deleting allocations
*
* @module mod_ratingallocate/radiobuttondeselect
* @class radiobuttondeselect
* @package mod_ratingallocate
* @copyright 2017 Tobias Reischmann
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
Expand Down
6 changes: 6 additions & 0 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@
* @return mixed true if the feature is supported, null if unknown
*/
function ratingallocate_supports($feature) {
if (defined('FEATURE_MOD_PURPOSE')) {
if ($feature == FEATURE_MOD_PURPOSE) {
return MOD_PURPOSE_ADMINISTRATION;
}
}

switch ($feature) {
case FEATURE_MOD_INTRO :
return true;
Expand Down
1 change: 1 addition & 0 deletions pix/monologo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 8 additions & 17 deletions tests/behat/allocation_status.feature
Original file line number Diff line number Diff line change
Expand Up @@ -21,61 +21,52 @@ Feature: Students should get status information according to their rating and th
| activity | course | idnumber | name | accesstimestart |
| ratingallocate | C1 | ra1 | My Fair Allocation | ##yesterday## |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I follow "My Fair Allocation"
And I am on the "My Fair Allocation" "ratingallocate activity" page
And I press "Edit Choices"
And I add a new choice with the values:
| title | My only choice |
| Description (optional) | Test |
| maxsize | 1 |
And I log out
And I log in as "student1"
And I am on "Course 1" course homepage
And I follow "My Fair Allocation"
And I am on the "My Fair Allocation" "ratingallocate activity" page
And I press "Edit Rating"
And I press "Save changes"
And I log out
And I log in as "student2"
And I am on "Course 1" course homepage
And I follow "My Fair Allocation"
And I am on the "My Fair Allocation" "ratingallocate activity" page
And I press "Edit Rating"
And I click on "Deny" "radio"
And I press "Save changes"
And I log out
And I log in as "teacher1"
And I am on "Course 1" course homepage
And I follow "My Fair Allocation"
And I navigate to "Edit settings" in current page administration
And I am on the "My Fair Allocation" "ratingallocate activity editing" page
And I set the following fields to these values:
| Rating begins at | ##2 days ago## |
| Rating ends at | ##yesterday## |
And I press "id_submitbutton"
And I run the scheduled task "mod_ratingallocate\task\cron_task"
And I am on "Course 1" course homepage
And I follow "My Fair Allocation"
And I am on the "My Fair Allocation" "ratingallocate activity" page
And I press "Publish Allocation"
And I log out

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

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

@javascript
Scenario: As a user, who did not rate, I should not see my allocated choice
When I log in as "student3"
And I am on "Course 1" course homepage
And I follow "My Fair Allocation"
And I am on the "My Fair Allocation" "ratingallocate activity" page
Then I should not see "Your Allocation"
And I should see "The rating is over." in the "//*[contains(@class, 'alert-info')]" "xpath_element"
2 changes: 1 addition & 1 deletion tests/behat/behat_mod_ratingallocate.php
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ public function i_rate_choices_with_the_following_points(TableNode $ratingdata)
$ratingdatehash = $ratingdata->getRowsHash();
// The action depends on the field type.
foreach ($ratingdatehash as $choice => $value) {
$fieldxpath = "//legend[normalize-space(.)=\"$choice\"]/ancestor::fieldset/descendant::input[@type='text']";
$fieldxpath = "//*[contains(text(), '$choice')]/ancestor::fieldset/descendant::input[@type='text']";
try {
$option = $this->find('xpath', $fieldxpath);
$option->setValue($value);
Expand Down
Loading

0 comments on commit 094e599

Please sign in to comment.