Skip to content

Catalyst master update and fix Unit test #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
a86463a
Remove three cases of double empty lines causing gherkinlint task to …
trampgeek Sep 6, 2022
1319536
Add functionality to show/hide the author's solution, defaulting to h…
trampgeek Sep 15, 2022
b0d4b3b
Document the importance of setting the jobe_host when testing with
trampgeek Oct 18, 2022
e0360b9
Rather than falling back to the config-dist test configuration is an
trampgeek Oct 18, 2022
4035661
Be a bit more tolerant on the size of the course export, as it changes
trampgeek Oct 18, 2022
3bdd5fa
Disable the alert message when testing python template params, since
trampgeek Oct 23, 2022
b1566fe
Documentation tweak
trampgeek Oct 24, 2022
c40ab2f
Delete loading of now-deprecated formchangechecker, which was a work-…
trampgeek Nov 1, 2022
a944c23
Documentation tweak (delete stray text).
trampgeek Nov 2, 2022
40ee51e
Switch the code that checks to see if behat is running to use a global
trampgeek Nov 2, 2022
98d1e9c
Turn off the alert using the 'behat is ruunning' global variable, sin…
trampgeek Nov 2, 2022
358016f
Improve the error message when the Moodle security settings
trampgeek Nov 3, 2022
d3939ba
Change octave prototype to insert a dummy statement to make file a
trampgeek Nov 3, 2022
7a7cbce
Remove erroneously-added debugging call.
trampgeek Nov 3, 2022
609b0d7
Switch source file name to just 'prog' in octave question type.
trampgeek Nov 3, 2022
bba213d
Change Octave test for compatibility with modified question type.
trampgeek Nov 3, 2022
f4b46d6
Style tweaks for better coding-standard compliance.
trampgeek Nov 3, 2022
344a8bb
Bug fix: old prototypes were not being deleted during an upgrade,
trampgeek Nov 3, 2022
5b1538d
Bug fix: GraphUI wasn't working in the question authoring form.
trampgeek Nov 5, 2022
f4de021
Change Interface wrapper to use taller UI areas when there is too
trampgeek Nov 5, 2022
94557ea
Update version number and change history.
trampgeek Nov 5, 2022
62b5d59
Load ace if the html ui is being used, in case it's needed.
trampgeek Nov 5, 2022
4e96d98
Remove stray console statement.
trampgeek Nov 5, 2022
3cc6d4c
Adjust wrong savepoint for 2016111200 (was string, s.b. int).
trampgeek Nov 5, 2022
4e92817
Constrain file to use within Moodle only.
trampgeek Nov 5, 2022
a5cf13e
Documentation tweaks.
trampgeek Nov 6, 2022
533bcf4
Bug fix: code not working in Docker Desktop container (though OK with
trampgeek Nov 7, 2022
fca252b
Restructure phpunit tests to conform to phpunit's standards on the
trampgeek Nov 8, 2022
2c40b0e
Tweak that seems relevant when testing in Docker Desktop rather than …
trampgeek Nov 8, 2022
0a01365
Commit minified code as well (erroneously omitted from a previous com…
trampgeek Nov 8, 2022
057a03b
Update version and change history.
trampgeek Nov 8, 2022
26b3172
Remove partiallyupdatedgraph code
trampgeek Nov 8, 2022
3b6a891
Merge branch 'development'
trampgeek Nov 8, 2022
a9c338f
Update version number in Readme.
trampgeek Nov 8, 2022
d959d57
Remove unneeded use statement
timhunt Jan 13, 2023
a20b065
Avoid failures when PHP language is not available
timhunt Jan 13, 2023
043d175
Update githup actions config to test with PHP 8 and Moodle 4.1
timhunt Jan 13, 2023
aa21c70
Merge pull request #159 from timhunt/fixes
trampgeek Jan 23, 2023
47c6dc9
Work around alert issues by disabling UI plugins.
trampgeek Jan 25, 2023
454e0d2
Update uoctkinterprototype.xml
trampgeek Feb 23, 2023
5ab5abc
Merge remote-tracking branch 'origin/master' into catalyst-master_update
Apr 14, 2023
d7688c2
WR401356 skip test as sandbox env is not available
Mar 30, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,19 @@ jobs:
fail-fast: false
matrix:
include:
- php: '8.0'
moodle-branch: 'master'
database: 'pgsql'
- php: '7.4'
moodle-branch: 'MOODLE_400_STABLE'
moodle-branch: 'MOODLE_401_STABLE'
database: 'pgsql'
- php: '7.3'
moodle-branch: 'MOODLE_400_STABLE'
database: 'mariadb'

services:
postgres:
image: postgres:10
image: postgres:13
env:
POSTGRES_USER: 'postgres'
POSTGRES_HOST_AUTH_METHOD: 'trust'
Expand Down Expand Up @@ -119,7 +122,7 @@ jobs:
run: moodle-plugin-ci mustache

- name: Grunt
if: ${{ always() }}
if: ${{ matrix.moodle-branch == 'MOODLE_400_STABLE' }}
run: moodle-plugin-ci grunt

- name: PHPUnit tests
Expand Down
58 changes: 39 additions & 19 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# CodeRunner

Version: 5.0.0 22 August 2022. Requires **MOODLE V4.0 or later**. Earlier versions
Version: 5.1.1 9 November 2022. Requires **MOODLE V4.0 or later**. Earlier versions
of Moodle must use CodeRunner V4.


Expand Down Expand Up @@ -1327,21 +1327,34 @@ Then Twig can simply select a specific variant from a set of variants as shown
in the section [Miscellaneous tips](#miscellaneous-tips).

An alternative approach is to compute the
template parameters in the same language as that of the question, e.g. Python,
Java etc. This can be done by setting the template parameter Preprocessor
to your language of choice and writing a program in that language in the
template parameters field. This is a powerful and still somewhat experimental method.
Furthermore it suffers from a potentially major disadvantage. The evaluation
of the template parameters takes place on the sandbox server, and when a student
template parameters in an alternative language of your choice - one that is supported
by the sandbox (Jobe) server, e.g. Python
Java etc. You set the template parameter Preprocessor language
to your chosen language and fill the template parameters field with a program
in that language. The standard output from that program must be a JSON string
containing all the required template parameters. This is a very powerful method and makes
complex randomisation much easier than in Twig.

However, using a template preprocessor other than Twig suffers from one major disadvantage.
The evaluation of the template parameters takes place on the sandbox server, and when a student
starts a quiz, all their questions using this form of randomisation initiate a run
on the sandbox server and cannot even be displayed until the run completes. If
you are running a large test or exam, and students all start at the same time,
there can be thousands of jobs hitting the sandbox server within a few seconds.
This is almost certain to overload it! Caveat emptor! The approach should,
however, be safe for lab and assignment use, when students are not all
starting the quiz at the same time.
This is almost certain to overload it! Caveat emptor!

If you still wish to use this approach , here's how to do it.
Using a template preprocessor other than Twig should be safe for lab and assignment use,
when students are not all starting the quiz at the same time. We have also used
it cautiously in exams
at the University of Canterbury with courses of a few hundred students, but have
been careful to ensure that not too many questions in the exam use this
randomisation method. We have also mitigated the sandbox server overload risk by spreading
the exam start times for students over several minutes. Lastly, we have two
separate 8-core sandbox (Jobe) servers to give us a high throughput. Multiple
Jobe servers are supported by listing them all, separated by a semicolon, in
the CodeRunner settings Jobe server URL field.

If, despite the above warnings, you still wish to use this approach, here's how.

#### The template parameter preprocessor program

Expand Down Expand Up @@ -1383,9 +1396,15 @@ The question text could then say
Write a function {{ func_name }}() that prints a welcome message of the
form "Hello {{ first_name }}!".

However, please realise that that is an extremely bad example of when to use
Note that this simple example is chosen only to illustrate
the technique. It is a very bad example of *when* to use
a preprocessor, as the job is more easily and more efficiently done in Twig,
as explained in the section [Randomising questions](#randomising-questions).
Use of a non-Twig preprocessor is best suited to complex randomisation that is
difficult or impossible in Twig, or when you need to use the same language
as that of the question itself to ensure that the evaluation of any
expression is exactly correct.

Note, too, that *Twig All* must be set.

#### The Evaluate per run option
Expand Down Expand Up @@ -2436,7 +2455,7 @@ not recommended.

### The Ace Gap Filler UI

This is a new and still experimental variant on the Gap Filler UI in which
This is a variant on the Gap Filler UI in which
the text is rendered by the Ace editor with all usual syntax highlighting
but the user can edit only the text in the gaps.

Expand Down Expand Up @@ -2810,8 +2829,6 @@ first of the allowed languages otherwise.

## The 'qtype_coderunner_run_in_sandbox' web service

Note: This feature is experimental and may change in the future.

CodeRunner provides an Ajax-accessible web service that allows JavaScript code
to directly run jobs on the Jobe server. (More precisely, it runs jobs
on whatever sandbox has been configured for the specified language, but
Expand Down Expand Up @@ -2972,17 +2989,15 @@ The three scripts are:
usage within that category.

1. <moodle_home>/question/type/coderunner/downloadquizattempts.php
This script, which is still experimental,
This script
displays a list of all quizzes available to the logged in user,
allowing them to download a spreadsheet of all submissions to a selected quiz
by all students. The downloaded spreadsheet is suitable for off-line analysis,
and includes information not available in the exported Moodle responses
file, such as all intermediate submisssions and prechecks and the time of
each such action.

The download can be in either csv or excel format; the
latter is recommended for most cases because a long-standing bug in PHP's
`fputcsv` function can cause corrupted csv output files. The exported
The download can be in either csv or excel format. The exported
Excel spreadsheet can then be opened in Excel or Open Office and saved as
csv.

Expand Down Expand Up @@ -3054,6 +3069,11 @@ The three scripts are:
submissions and prechecks and their times etc is available.
See `quizsubmissions.py` for more information.

**Note** the script requires large amounts of memory and you may find it
fails with large classes. Increasing the *memory_limit* setting in *php.ini*
may solve the problem if you have administrative rights on the server to
change this.


## A note on accessibility

Expand Down
2 changes: 1 addition & 1 deletion ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

define('AJAX_SCRIPT', true);

require_once('../../../config.php');
require_once(__DIR__ . '/../../../config.php');
require_once($CFG->dirroot . '/question/engine/lib.php');
require_once($CFG->dirroot . '/question/type/coderunner/questiontype.php');

Expand Down
2 changes: 1 addition & 1 deletion amd/build/authorform.min.js

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

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

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

Loading