Skip to content

Commit

Permalink
Fixed multiple refactoring issues
Browse files Browse the repository at this point in the history
Question Bank Import Category missing
Wrong SQL Escape
  • Loading branch information
muqiuq committed Feb 13, 2019
1 parent 59587ee commit f62e9ec
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions classes/question/bank/difficulty_level_column.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions viewlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit f62e9ec

Please sign in to comment.