-
Bug
-
Resolution: Fixed
-
Minor
-
4.4.4, 4.5, 5.0
Steps to reproduce: - whether this is reproducible or not depends on the form of URL of the question/edit.php?cmid=1227 page are on when you try to view the history of a question, which depends on what you have been doing in the question bank.
Expected behaviour
- Go to a question bank using the normal navigation (e.g. https://qa.moodledemo.net/question/edit.php?cat=2,20278&cmid=1227 logged in as teacker)
- Select 'History' in the action menu for a question.
- You will get to a screen listing all the version of that question.
Steps to reproduce
- Get the question bank into a weird state, e.g. https://school.moodledemo.net/question/edit.php?courseid=57&cat=91,951 - I was hoping to find a clean way to achieve that, but I did not manage to.
- Select 'History' in the action menu for a question.
Actal result: Page title and controls are there, but there are no versions shown.
The issue is that this page is running a query like
SELECT q.id, q.qtype, q.createdby, qc.id as categoryid, qc.contextid, qv.status, qv.version, qv.id as versionid, qbe.id as questionbankentryid, q.name, qbe.idnumber, uc.firstnamephonetic AS creatorfirstnamephonetic, uc.lastnamephonetic AS creatorlastnamephonetic, uc.middlename AS creatormiddlename, uc.alternatename AS creatoralternatename, uc.firstname AS creatorfirstname, uc.lastname AS creatorlastname, q.timecreated, um.firstnamephonetic AS modifierfirstnamephonetic, um.lastnamephonetic AS modifierlastnamephonetic, um.middlename AS modifiermiddlename, um.alternatename AS modifieralternatename, um.firstname AS modifierfirstname, um.lastname AS modifierlastname, q.timemodified, qc.idnumber AS catidnumber |
|
FROM {question} q |
JOIN {question_versions} qv ON qv.questionid = q.id |
JOIN {question_bank_entries} qbe on qbe.id = qv.questionbankentryid |
JOIN {question_categories} qc ON qc.id = qbe.questioncategoryid |
LEFT JOIN {user} uc ON uc.id = q.createdby |
LEFT JOIN {user} um ON um.id = q.modifiedby |
|
WHERE q.parent = 0 |
AND qbe.id = 12345 |
AND ((qv.status <> 'hidden')) |
AND ((qbe.questioncategoryid = 5678)) |
|
ORDER BY q.timecreated ASC |
In this query, since we have qbe.id = 12345 then the AND qbe.questioncategoryid = 5678 bit is completely pointless. If that category id is right, then the page works. But, the category id coming from the URL is wrong then you get a blank page. (And, you might then try the 'Reset columns' button, which will make you even more confused! MDL-83831).