From f62e9ec8fa3c74e52b8e41e355932aacc8baa5bb Mon Sep 17 00:00:00 2001 From: Philipp Albrecht Date: Wed, 13 Feb 2019 03:21:14 +0100 Subject: [PATCH] Fixed multiple refactoring issues Question Bank Import Category missing Wrong SQL Escape --- classes/question/bank/difficulty_level_column.php | 4 ++-- viewlib.php | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/classes/question/bank/difficulty_level_column.php b/classes/question/bank/difficulty_level_column.php index bfadd5be..481d53ca 100644 --- a/classes/question/bank/difficulty_level_column.php +++ b/classes/question/bank/difficulty_level_column.php @@ -112,9 +112,9 @@ public function get_extra_joins() { GROUP BY qa.questionid ) dl ON dl.questionid = q.id", 'mydiffs' => "LEFT JOIN ( - SELECT ROUND(1-avg(case state when \'gradedright\' then 1 else 0 end),2) + SELECT ROUND(1-avg(case state when 'gradedright' then 1 else 0 end),2) AS mydifficulty, - sum(case state when \'gradedright\' then 1 else 0 end) AS mycorrectattempts, + sum(case state when 'gradedright' then 1 else 0 end) AS mycorrectattempts, questionid FROM {studentquiz_attempt} sqa JOIN {question_usages} qu ON qu.id = sqa.questionusageid diff --git a/viewlib.php b/viewlib.php index 7e1e0c41..5b290eb8 100755 --- a/viewlib.php +++ b/viewlib.php @@ -129,6 +129,8 @@ private function load_questionbank() { // TODO: We should fix these with the updates and restore functions (analog fix question category etc.) mod_studentquiz_ensure_question_capabilities($this->context); + $_POST['cat'] = $this->get_category_id() . ',' . $this->get_context_id(); + // Get edit question link setup list($thispageurl, $contexts, $cmid, $cm, $module, $pagevars) = question_edit_setup('questions', '/mod/studentquiz/view.php', true);