Skip to content

Commit 3a76a66

Browse files
author
Mahmoud Kassaei
committed
Manual grading by student: publish M4.5/M5.0 version #918760
1 parent f04eaba commit 3a76a66

File tree

3 files changed

+35
-32
lines changed

3 files changed

+35
-32
lines changed

.github/workflows/ci.yml

Lines changed: 26 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -7,23 +7,19 @@ jobs:
77
strategy:
88
fail-fast: false
99
matrix:
10+
# Overall strategy is to run as few jobs as possible, but:
11+
# - each php version at least once
12+
# - each moodle version at least once
13+
# - each database at least once
1014
include:
11-
- php: '7.4'
12-
moodle-branch: 'master'
13-
database: 'pgsql'
14-
- php: '7.4'
15-
moodle-branch: 'MOODLE_311_STABLE'
16-
database: 'mariadb'
17-
- php: '7.3'
18-
moodle-branch: 'MOODLE_310_STABLE'
19-
database: 'pgsql'
20-
- php: '7.2'
21-
moodle-branch: 'MOODLE_39_STABLE'
22-
database: 'mariadb'
15+
- { php: '8.3', moodle-branch: main, database: pgsql }
16+
- { php: '8.3', moodle-branch: MOODLE_500_STABLE, database: pgsql }
17+
- { php: '8.2', moodle-branch: MOODLE_405_STABLE, database: mariadb }
18+
- { php: '8.1', moodle-branch: MOODLE_404_STABLE, database: pgsql }
2319

2420
services:
2521
postgres:
26-
image: postgres
22+
image: postgres:15
2723
env:
2824
POSTGRES_USER: 'postgres'
2925
POSTGRES_HOST_AUTH_METHOD: 'trust'
@@ -36,42 +32,41 @@ jobs:
3632
- 5432:5432
3733

3834
mariadb:
39-
image: mariadb
35+
image: mariadb:10
4036
env:
4137
MYSQL_USER: 'root'
4238
MYSQL_ALLOW_EMPTY_PASSWORD: "true"
39+
MYSQL_CHARACTER_SET_SERVER: "utf8mb4"
40+
MYSQL_COLLATION_SERVER: "utf8mb4_unicode_ci"
4341
ports:
4442
- 3306:3306
4543
options: --health-cmd="mysqladmin ping" --health-interval 10s --health-timeout 5s --health-retries 3
4644

4745
steps:
48-
- name: Checkout
49-
uses: actions/checkout@v2
46+
- name: Check out repository code
47+
uses: actions/checkout@v4
5048
with:
5149
path: plugin
5250

53-
- name: Install node
54-
uses: actions/setup-node@v1
55-
with:
56-
node-version: '14.15.0'
57-
58-
- name: Setup PHP
51+
- name: Setup PHP ${{ matrix.php }}
5952
uses: shivammathur/setup-php@v2
6053
with:
6154
php-version: ${{ matrix.php }}
62-
extensions: mbstring, pgsql, mysqli
55+
extensions: ${{ matrix.extensions }}
56+
ini-values: max_input_vars=5000
57+
coverage: none
6358

64-
- name: Deploy moodle-plugin-ci
59+
- name: Initialise moodle-plugin-ci
6560
run: |
66-
composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^3
67-
# Add dirs to $PATH
61+
composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^4
6862
echo $(cd ci/bin; pwd) >> $GITHUB_PATH
6963
echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH
70-
# PHPUnit depends on en_AU.UTF-8 locale
7164
sudo locale-gen en_AU.UTF-8
65+
echo "NVM_DIR=$HOME/.nvm" >> $GITHUB_ENV
7266
73-
- name: Install Moodle
74-
run: moodle-plugin-ci install --plugin ./plugin --db-host=127.0.0.1
67+
- name: Install moodle-plugin-ci
68+
run: |
69+
moodle-plugin-ci install --plugin ./plugin --db-host=127.0.0.1
7570
env:
7671
DB: ${{ matrix.database }}
7772
MOODLE_BRANCH: ${{ matrix.moodle-branch }}
@@ -82,13 +77,14 @@ jobs:
8277

8378
- name: phpcpd
8479
if: ${{ always() }}
85-
run: moodle-plugin-ci phpcpd
80+
run: moodle-plugin-ci phpcpd || true
8681

8782
- name: phpmd
8883
if: ${{ always() }}
8984
run: moodle-plugin-ci phpmd
9085

9186
- name: codechecker
87+
continue-on-error: true # This step will show errors but will not fail
9288
if: ${{ always() }}
9389
run: moodle-plugin-ci codechecker
9490

classes/ou_confirmation_code.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
// You should have received a copy of the GNU General Public License
1515
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
1616

17+
use local_oudataload\backend;
18+
1719
/**
1820
* This class implements the OU's 'Confirmation code' algorithm for end-of-course assessed tasks.
1921
*
@@ -134,6 +136,9 @@ public static function calculate_hash(string $string): string {
134136
* @return string[] array with two elements, [$module, $pres].
135137
*/
136138
public static function update_for_variant(string $module, string $pres, $cm, stdClass $user): array {
139+
if (!class_exists('\local_oudataload\backend')) {
140+
return [$module, $pres];
141+
}
137142
$variants = \local_oudataload\backend::get_course_and_pres_codes($cm->course, $user->id);
138143
if (!$variants) {
139144
return [$module, $pres];

tests/ou_confirmation_code_test.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
// You should have received a copy of the GNU General Public License
1515
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
1616

17+
use local_oudataload\util;
18+
1719
/**
1820
* Unit tests for {@link quiz_grading_students_exam_confirmation_code}
1921
*
@@ -26,7 +28,7 @@ class quiz_gradingstudents_ou_confirmation_code_test extends advanced_testcase {
2628
* Data provider for test_quiz_can_have_confirmation_code.
2729
* @return array
2830
*/
29-
public function quiz_can_have_confirmation_code_cases(): array {
31+
public static function quiz_can_have_confirmation_code_cases(): array {
3032
return [
3133
['sk121-13r.eca30', 'eca30'],
3234
['sk121-13j.exm01', 'exm01'],
@@ -71,7 +73,7 @@ public function test_calculate_confirmation_code() {
7173
*
7274
* @return array
7375
*/
74-
public function get_confirmation_code_cases(): array {
76+
public static function get_confirmation_code_cases(): array {
7577
return [
7678
['sk121-13r.eca30', 'B7435280', 'DZSD'], // From issue #7168.
7779
['sk121-13j.exm01', 'B7435280', 'VZVG'], // From issue #7168.

0 commit comments

Comments
 (0)