Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into merge-upstream-in…
Browse files Browse the repository at this point in the history
…to-catalyst-stable

Conflicts:
 - .github/workflows/moodle-ci.yml: Accepted incoming
 - tests/fixtures/test_base.php: Accepted incoming
  • Loading branch information
ScottVerbeek committed Jan 16, 2024
2 parents ef45d4f + f39c8c5 commit 881352c
Show file tree
Hide file tree
Showing 483 changed files with 54,570 additions and 112,633 deletions.
35 changes: 20 additions & 15 deletions .github/workflows/moodle-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 3
mariadb:
image: mariadb:10
image: mariadb:10.6
env:
MYSQL_USER: 'root'
MYSQL_ALLOW_EMPTY_PASSWORD: "true"
Expand All @@ -32,29 +32,34 @@ jobs:
matrix: # I don't know why, but mariadb is much slower, so mostly use pgsql.
# We use a mix of SBCL and GCL, but mostly prefer SBCL as it is faster.
include:
- php: '8.0'
- php: '8.2'
moodle-branch: 'master'
database: 'pgsql'
maxima: 'SBCL'
- php: '7.4'
moodle-branch: 'MOODLE_401_STABLE'
- php: '8.1'
moodle-branch: 'MOODLE_402_STABLE'
database: 'pgsql'
maxima: 'GCL'
- php: '8.0'
moodle-branch: 'MOODLE_402_STABLE'
database: 'pgsql'
maxima: 'SBCL'
# Edinburgh is planning to run the setup below for 2023-24.
- php: '7.4'
moodle-branch: 'MOODLE_400_STABLE'
database: 'pgsql'
moodle-branch: 'MOODLE_401_STABLE'
database: 'mariadb'
maxima: 'GCL'
- php: '7.3'
moodle-branch: 'MOODLE_311_STABLE'
- php: '7.4'
moodle-branch: 'MOODLE_400_STABLE'
database: 'pgsql'
maxima: 'SBCL'
- php: '7.3'
moodle-branch: 'MOODLE_310_STABLE'
moodle-branch: 'MOODLE_311_STABLE'
database: 'pgsql'
maxima: 'SBCL'
- php: '7.2'
moodle-branch: 'MOODLE_39_STABLE'
database: 'mariadb'
database: 'pgsql'
maxima: 'SBCL'

steps:
Expand All @@ -71,7 +76,7 @@ jobs:
echo "build_info();" | maxima
- name: Check out repository code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
path: plugin

Expand All @@ -90,7 +95,7 @@ jobs:
echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH
sudo locale-gen en_AU.UTF-8
echo "NVM_DIR=$HOME/.nvm" >> $GITHUB_ENV
- name: Install moodle-plugin-ci
run: |
moodle-plugin-ci add-plugin maths/moodle-qbehaviour_dfexplicitvaildate
Expand All @@ -112,10 +117,10 @@ jobs:
moodle-plugin-ci add-config 'define("QTYPE_STACK_TEST_CONFIG_CASDEBUGGING", "0");'
#cat ${{ github.workspace }}/moodle/config.php
cp ${{ github.workspace }}/moodledata/phpu_moodledata/stack/maxima_opt_auto ${{ github.workspace }}/maxima_opt_auto
# Try a command on the command line.
# echo "1+1; quit();" | timeout --kill-after=10s 10s ${{ github.workspace }}/maxima_opt_auto -eval '(cl-user::run)'
# echo "1+1; quit();" | timeout --kill-after=100s 100s ${{ github.workspace }}/maxima_opt_auto -eval '(cl-user::run)'
env:
Expand Down Expand Up @@ -159,7 +164,7 @@ jobs:
run: moodle-plugin-ci mustache

- name: Grunt
if: ${{ matrix.moodle-branch == 'MOODLE_311_STABLE' }}
if: ${{ matrix.moodle-branch == 'MOODLE_401_STABLE' }}
run: moodle-plugin-ci grunt

- name: PHPUnit tests
Expand Down
17 changes: 6 additions & 11 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,23 @@
# STACK 4.4.2
# STACK 4.5.0

STACK is an assessment system for mathematics, science and related disciplines. STACK is a question type for the Moodle learning management system, and also the ILIAS learning management system.

STACK was created by [Chris Sangwin](http://www.maths.ed.ac.uk/~csangwin/) of the University of Edinburgh, and includes the work of many [other contributors](https://github.com/maths/moodle-qtype_stack/blob/master/doc/en/About/Credits.md). The mains STACK project website is [https://stack-assessment.org/](https://stack-assessment.org/).
The mains STACK project website is [https://stack-assessment.org/](https://stack-assessment.org/).

STACK was created by [Chris Sangwin](http://www.maths.ed.ac.uk/~csangwin/) of the University of Edinburgh, and includes the work of many [other contributors](https://github.com/maths/moodle-qtype_stack/blob/master/doc/en/About/Credits.md).
STACK is based on continuing research and use at the University of Edinburgh, the Open University, Aalto, Loughborough University, the University of Birmingham and others.

## Current state of development

STACK 4.4 replaces core features with ones implemented using re-engineered core components. Primary focus has been in runtime performance improvements and finalising multi-year projects related to PRT logic improvements.
For general authoring support please see the Zulip chat [https://stack-assessment.zulipchat.com/](https://stack-assessment.zulipchat.com/). Please continue to report any bugs you find at [https://github.com/maths/moodle-qtype_stack/issues](https://github.com/maths/moodle-qtype_stack/issues).

In addition to that the CASText templating system has been replaced with a new version that fixes some issues with the old and provides better support for Markdown. The new version of this templating system will play a role in the next major re-engineering project that relates to the inputs and their validation.

Some specialised features have also been provided for advanced users.

Please continue to report any bugs you find at https://github.com/maths/moodle-qtype_stack/issues.
The STACK project has been running since 2005, and we are committed to long term support within Moodle. We aim to maintain this plugin to work with versions of Moodle, both currently supported and current security releases, see [Moodle versions](https://docs.moodle.org/dev/Releases#Version_support) for more details. We are also committed to support STACK within ILIAS. If your version of Moodle or ILIAS is not listed as supported please do contact the developers for more information.

The [current state of development](https://github.com/maths/moodle-qtype_stack/blob/master/doc/en/Developer/Development_track.md) is explained more fully in the [developer documentation](https://github.com/maths/moodle-qtype_stack/blob/master/doc/en/Developer/index.md).

The STACK project has been running since 2005, and we are committed to long term support within Moodle. We aim to maintain this plugin to work with versions of Moodle, both currently supported and current security releases, see [Moodle versions](https://docs.moodle.org/dev/Releases#Version_support) for more details. We are also committed to support STACK within ILIAS. If your version of Moodle or ILIAS is not listed as supported please do contact the developers for more information.

## Documentation

The [documentation is here](https://stack-assessment.org/), including the [installation instructions](https://docs.stack-assessment.org/en/Installation/).
The [documentation is here](https://docs.stack-assessment.org/en/), including the [installation instructions](https://docs.stack-assessment.org/en/Installation/).

## License

Expand Down
5 changes: 3 additions & 2 deletions adminui/bulktest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,10 @@
// Get the parameters from the URL.
$contextid = required_param('contextid', PARAM_INT);
$context = context::instance_by_id($contextid);
$categoryid = optional_param('categoryid', null, PARAM_INT);

$skippreviouspasses = optional_param('skippreviouspasses', false, PARAM_BOOL);
$urlparams = ['contextid' => $context->id];
$urlparams = ['contextid' => $context->id, 'categoryid' => $categoryid];
if ($skippreviouspasses) {
$urlparams['skippreviouspasses'] = 1;
}
Expand Down Expand Up @@ -72,7 +73,7 @@

// Run the tests.
list($allpassed, $failing) = $bulktester->run_all_tests_for_context(
$context, 'web', false, $skippreviouspasses);
$context, $categoryid, 'web', false, $skippreviouspasses);

// Display the final summary.
$bulktester->print_overall_result($allpassed, $failing);
Expand Down
29 changes: 16 additions & 13 deletions adminui/bulktestall.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
require_once(__DIR__ . '/../stack/utils.class.php');
require_once(__DIR__ . '/../stack/bulktester.class.php');

// Increase memory limit: some users with very large numbers of questions/variants have needed this.
raise_memory_limit(MEMORY_HUGE);

// Get the parameters from the URL. This is an option to restart the process
// in the middle. Useful if it crashes.
Expand Down Expand Up @@ -72,26 +74,27 @@
echo $OUTPUT->heading($title, 1);

// Run the tests.
foreach ($bulktester->get_stack_questions_by_context() as $contextid => $numstackquestions) {
foreach ($bulktester->get_num_stack_questions_by_context() as $contextid => $numstackquestions) {
if ($skipping && $contextid != $startfromcontextid) {
continue;
}
$skipping = false;
$testcontext = context::instance_by_id($contextid);

echo $OUTPUT->heading(stack_string('bulktesttitle', $testcontext->get_context_name()));
echo html_writer::tag('p', html_writer::link(
new moodle_url('/question/type/stack/bulktestall.php', $urlparams),
$testcontext = context::instance_by_id($contextid);
if (has_capability('moodle/question:editall', $testcontext)) {
echo $OUTPUT->heading(get_string('bulktesttitle', 'qtype_stack', $testcontext->get_context_name()));
echo html_writer::tag('p', html_writer::link(
new moodle_url('/question/type/stack/adminui/bulktestall.php', $urlparams),
stack_string('bulktestcontinuefromhere')));

list($passed, $failing) = $bulktester->run_all_tests_for_context($testcontext, 'web', false, $skippreviouspasses);
$allpassed = $allpassed && $passed;
foreach ($failing as $key => $arrvals) {
// Guard clause here to future proof any new fields from the bulk tester.
if (!array_key_exists($key, $allfailing)) {
$allfailing[$key] = array();
list($passed, $failing) = $bulktester->run_all_tests_for_context($testcontext, null, 'web', false, $skippreviouspasses);
$allpassed = $allpassed && $passed;
foreach ($failing as $key => $arrvals) {
// Guard clause here to future proof any new fields from the bulk tester.
if (!array_key_exists($key, $allfailing)) {
$allfailing[$key] = array();
}
$allfailing[$key] = array_merge($allfailing[$key], $arrvals);
}
$allfailing[$key] = array_merge($allfailing[$key], $arrvals);
}
}

Expand Down
70 changes: 59 additions & 11 deletions adminui/bulktestindex.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,19 +54,67 @@
echo $OUTPUT->header();
echo $OUTPUT->heading(stack_string('replacedollarsindex'));

echo html_writer::start_tag('ul');
foreach ($bulktester->get_stack_questions_by_context() as $contextid => $numstackquestions) {
echo html_writer::tag('li', html_writer::link(
new moodle_url('/question/type/stack/adminui/bulktest.php',
$urlparams + ['contextid' => $contextid]),
context::instance_by_id($contextid)->get_context_name(true, true) . ' (' . $numstackquestions . ')'));
// Find in which contexts the user can edit questions.
$questionsbycontext = $bulktester->get_num_stack_questions_by_context();
$availablequestionsbycontext = array();
foreach ($questionsbycontext as $contextid => $numquestions) {
$context = context::instance_by_id($contextid);
if (has_capability('moodle/question:editall', $context)) {
$name = $context->get_context_name(true, true);
if (strpos($name, 'Quiz:') === 0) { // Quiz-specific question category.
$course = $context->get_course_context(false);
if ($course === false) {
$name = 'UnknownCourse: ' . $name;
} else {
$name = $course->get_context_name(true, true) . ': ' . $name;
}
}
$availablequestionsbycontext[$name] = array(
'contextid' => $contextid,
'numquestions' => $numquestions);
}
}
echo html_writer::end_tag('ul');

if (has_capability('moodle/site:config', context_system::instance())) {
echo html_writer::tag('p', html_writer::link(
new moodle_url('/question/type/stack/adminui/bulktestall.php', $urlparams),
stack_string('bulktestrun')));
ksort($availablequestionsbycontext);

// List all contexts available to the user.
if (count($availablequestionsbycontext) == 0) {
echo html_writer::tag('p', get_string('unauthorisedbulktest', 'qtype_stack'));
} else {
echo html_writer::start_tag('ul');
foreach ($availablequestionsbycontext as $name => $info) {
$contextid = $info['contextid'];
$numquestions = $info['numquestions'];

$testallurl = new moodle_url('/question/type/stack/adminui/bulktest.php', array('contextid' => $contextid));
$testalllink = html_writer::link($testallurl,
get_string('bulktestallincontext', 'qtype_stack'), array('title' => get_string('testalltitle', 'qtype_stack')));
$litext = $name . ' (' . $numquestions . ') ' . $testalllink;

echo html_writer::start_tag('details');
echo html_writer::tag('summary', $litext);

$categories = $bulktester->get_categories_for_context($contextid);
echo html_writer::start_tag('ul', array('class' => 'expandable'));
foreach ($categories as $cat) {
if ($cat->count > 0) {
$url = new moodle_url('/question/type/stack/adminui/bulktest.php',
array('contextid' => $contextid, 'categoryid' => $cat->id));
$linktext = $cat->name . ' (' . $cat->count . ')';
$link = html_writer::link($url, $linktext);
echo html_writer::tag('li', $link,
array('title' => get_string('testallincategory', 'qtype_stack')));
}
}
echo html_writer::end_tag('ul');
echo html_writer::end_tag('details');
}
echo html_writer::end_tag('ul');

if (has_capability('moodle/site:config', context_system::instance())) {
echo html_writer::tag('p', html_writer::link(
new moodle_url('/question/type/stack/adminui/bulktestall.php'), get_string('bulktestrun', 'qtype_stack')));
}
}

echo $OUTPUT->footer();
Loading

0 comments on commit 881352c

Please sign in to comment.