diff --git a/.travis.yml b/.travis.yml index 01f9a56..dca51b1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,68 +2,53 @@ language: php sudo: false +addons: + firefox: "47.0.1" + postgresql: "9.3" + apt: + packages: + - oracle-java8-installer + - oracle-java8-set-default + cache: directories: - $HOME/.composer/cache + - $HOME/.npm php: - 5.6 - 7.0 + - 7.1 env: - - MOODLE_BRANCH=MOODLE_31_STABLE DB=mysqli - - MOODLE_BRANCH=MOODLE_30_STABLE DB=pgsql - - MOODLE_BRANCH=MOODLE_29_STABLE DB=mysqli - - MOODLE_BRANCH=MOODLE_28_STABLE DB=pgsql - - MOODLE_BRANCH=MOODLE_27_STABLE DB=mysqli - -matrix: - exclude: - - php: 7.0 - env: MOODLE_BRANCH=MOODLE_29_STABLE DB=mysqli - - php: 7.0 - env: MOODLE_BRANCH=MOODLE_28_STABLE DB=pgsql - - php: 7.0 - env: MOODLE_BRANCH=MOODLE_27_STABLE DB=mysqli - - php: 5.6 - env: MOODLE_BRANCH=MOODLE_31_STABLE DB=mysqli - - php: 5.6 - env: MOODLE_BRANCH=MOODLE_30_STABLE DB=pgsql - - php: 5.6 - env: MOODLE_BRANCH=MOODLE_29_STABLE DB=mysqli - - php: 5.6 - env: MOODLE_BRANCH=MOODLE_28_STABLE DB=pgsql - - php: 5.6 - env: MOODLE_BRANCH=MOODLE_27_STABLE DB=mysqli - include: - - php: 5.4 - env: MOODLE_BRANCH=MOODLE_31_STABLE DB=mysqli - - php: 5.4 - env: MOODLE_BRANCH=MOODLE_30_STABLE DB=pgsql - - php: 5.4 - env: MOODLE_BRANCH=MOODLE_29_STABLE DB=mysqli - - php: 5.4 - env: MOODLE_BRANCH=MOODLE_28_STABLE DB=pgsql - - php: 5.4 - env: MOODLE_BRANCH=MOODLE_27_STABLE DB=mysqli + global: + - MOODLE_BRANCH=MOODLE_32_STABLE IGNORE_PATHS=quizzes,lang + - MOODLE_BRANCH=MOODLE_33_STABLE IGNORE_PATHS=quizzes,lang + matrix: + - DB=pgsql + - DB=mysqli before_install: - phpenv config-rm xdebug.ini + - nvm install 8.9 + - nvm use 8.9 - cd ../.. - - composer selfupdate - - composer create-project -n --no-dev --prefer-dist moodlerooms/moodle-plugin-ci ci ^1 + - composer create-project -n --no-dev --prefer-dist moodlerooms/moodle-plugin-ci ci ^2 - export PATH="$(cd ci/bin; pwd):$(cd ci/vendor/bin; pwd):$PATH" install: - - moodle-plugin-ci add-plugin wiris/moodle-filter_wiris - - moodle-plugin-ci add-plugin wiris/moodle-qtype_wq + - moodle-plugin-ci add-plugin --branch development wiris/moodle-filter_wiris + - moodle-plugin-ci add-plugin --branch development wiris/moodle-qtype_wq - moodle-plugin-ci install + script: - moodle-plugin-ci phplint - moodle-plugin-ci phpcpd - moodle-plugin-ci phpmd - moodle-plugin-ci codechecker - - moodle-plugin-ci shifter - moodle-plugin-ci validate + - moodle-plugin-ci savepoints + - moodle-plugin-ci mustache + - moodle-plugin-ci grunt -t css - moodle-plugin-ci phpunit - moodle-plugin-ci behat diff --git a/question.php b/question.php index 4874fb9..048b39d 100644 --- a/question.php +++ b/question.php @@ -100,7 +100,6 @@ private function set_shortanswer_matching_answers(array $response) { $needsgrade = true; } } - } } @@ -123,7 +122,7 @@ private function set_shortanswer_matching_answers(array $response) { if (empty($qimpl->assertions)) { $qimpl->setAssertion("equivalent_symbolic", 0, 0); } - + // Remove all non-syntactic assertions from question and save to $assertions array. for ($i = $qimpl->assertions->length - 1; $i >= 0; $i--) { $assertion = $qimpl->assertions[$i]; diff --git a/renderer.php b/renderer.php index 19adf73..f577c1f 100644 --- a/renderer.php +++ b/renderer.php @@ -61,7 +61,7 @@ public function __construct($subq) { } // Shortanswerwiris grading. public function get_matching_answer(array $response) { - if (isset($response['answer'])) { + if (isset($response['answer']) || $response['answer'] == null) { if (!empty($response['correct_response'])) { // This is called to produce de feedback popup "The correct response is ...". return $this->subq->base->get_matching_answer($this->subq->base->get_correct_response()); @@ -128,11 +128,11 @@ public function subquestion(question_attempt $qa, question_display_options $opti $size = 1; if (class_exists('core_text')) { if ($response != null) { - // Plain response, the size of the input is the same that the size of the response. - if (substr($response, 0, 5) != "get_question()->expand_variables_text($response) +1; + $size = $qa->get_question()->expand_variables_text($response) + 1; } } else { @@ -142,11 +142,11 @@ public function subquestion(question_attempt $qa, question_display_options $opti } } else { if ($response != null) { - // Plain response, the size of the input is the same that the size of the response. - if (substr($response, 0, 5) != "get_question()->expand_variables_text($response) +1; + $size = $qa->get_question()->expand_variables_text($response) + 1; } } else { diff --git a/version.php b/version.php index 90d3cd0..74cd632 100644 --- a/version.php +++ b/version.php @@ -16,11 +16,11 @@ defined('MOODLE_INTERNAL') || die(); -$plugin->version = 2017110600; +$plugin->version = 2017112300; $plugin->release = '3.58.0.1029'; $plugin->requires = 2011060313; $plugin->maturity = MATURITY_STABLE; $plugin->component = 'qtype_multianswerwiris'; $plugin->dependencies = array ( - 'qtype_wq' => 2017110600 + 'qtype_wq' => 2017112300 );