Skip to content

Commit

Permalink
MDL-76717 question: Coding style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnicols committed Jul 9, 2023
1 parent 05a8ac5 commit 1402965
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 22 deletions.
7 changes: 3 additions & 4 deletions mod/quiz/tests/behat/behat_mod_quiz.php
Expand Up @@ -28,10 +28,9 @@
require_once(__DIR__ . '/../../../../lib/behat/behat_base.php');
require_once(__DIR__ . '/../../../../question/tests/behat/behat_question_base.php');

use Behat\Gherkin\Node\TableNode as TableNode;

use Behat\Mink\Exception\ExpectationException as ExpectationException;
use Behat\Mink\Exception\DriverException as DriverException;
use Behat\Gherkin\Node\TableNode;
use Behat\Mink\Exception\DriverException;
use Behat\Mink\Exception\ExpectationException;
use mod_quiz\quiz_attempt;
use mod_quiz\quiz_settings;

Expand Down
2 changes: 1 addition & 1 deletion question/bank/usage/amd/build/usage.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 question/bank/usage/amd/build/usage.min.js.map

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

3 changes: 2 additions & 1 deletion question/bank/usage/amd/src/usage.js
Expand Up @@ -38,7 +38,7 @@ let modal = null;
* @param {boolean} specificVersion Is the view listing specific question versions?
*/
const usageEvent = async(questionId, contextId, specificVersion) => {
let args = {
const args = {
questionid: questionId,
specificversion: specificVersion,
};
Expand All @@ -52,6 +52,7 @@ const usageEvent = async(questionId, contextId, specificVersion) => {
});
} catch (e) {
Notification.exception(e);
return;
}

modal.show();
Expand Down
26 changes: 13 additions & 13 deletions question/bank/usage/classes/helper.php
Expand Up @@ -54,8 +54,8 @@ public static function get_question_entry_usage_count($question, bool $specificv
*/
public static function question_usage_sql(bool $specificversion = false): string {
$sqlset = "(". self::get_question_attempt_usage_sql($specificversion) .")".
"UNION".
"(". self::get_question_bank_usage_sql($specificversion) .")";
"UNION".
"(". self::get_question_bank_usage_sql($specificversion) .")";
return $sqlset;
}

Expand Down Expand Up @@ -122,15 +122,15 @@ public static function get_question_bank_usage_sql(bool $specificversion = false
// or the question ID that's requested is the latest version, and the reference is set to null (always latest version).
$sql .= " AND qv.questionid = ?
AND (
qv.version = qr.version
OR (
qr.version IS NULL
AND qv.version = (
SELECT MAX(qv1.version)
FROM {question_versions} qv1
WHERE qv1.questionbankentryid = qbe.id
)
)
qv.version = qr.version
OR (
qr.version IS NULL
AND qv.version = (
SELECT MAX(qv1.version)
FROM {question_versions} qv1
WHERE qv1.questionbankentryid = qbe.id
)
)
)";
}
return $sql;
Expand Down Expand Up @@ -158,13 +158,13 @@ public static function get_question_attempt_usage_sql(bool $specificversion = fa
$sql .= "
JOIN {question} q ON q.id = qatt.questionid
WHERE qa.preview = 0
AND q.id = ?";
AND q.id = ?";
} else {
$sql .= "
JOIN {question_versions} qv ON qv.questionid = qatt.questionid
JOIN {question_versions} qv2 ON qv.questionbankentryid = qv2.questionbankentryid
WHERE qa.preview = 0
AND qv2.questionid = ?";
AND qv2.questionid = ?";
}
return $sql;
}
Expand Down
7 changes: 5 additions & 2 deletions question/bank/usage/classes/question_usage_column.php
Expand Up @@ -47,8 +47,11 @@ protected function display_content($question, $rowclasses): void {
if (question_has_capability_on($question, 'view')) {
$target = 'questionusagepreview_' . $question->id;
$datatarget = '[data-target="' . $target . '"]';
$PAGE->requires->js_call_amd('qbank_usage/usage', 'init',
[$datatarget, $question->contextid, $this->qbank->is_listing_specific_versions()]);
$PAGE->requires->js_call_amd('qbank_usage/usage', 'init', [
$datatarget,
$question->contextid,
$this->qbank->is_listing_specific_versions(),
]);
$attributes = [
'href' => '#',
'data-target' => $target,
Expand Down

0 comments on commit 1402965

Please sign in to comment.