Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-83832

Links to the question history page may include the wrong (or no) category id, leading to a blank page

XMLWordPrintable

      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

      1. 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)
      2. Select 'History' in the action menu for a question.
      3. You will get to a screen listing all the version of that question.

      Steps to reproduce

      1. 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.
      2. 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).

        1. MDL-83832.png
          MDL-83832.png
          300 kB
        2. testing instruction.webm
          5.71 MB
        3. testing instruction-1.webm
          5.71 MB
        4. the-bug.png
          the-bug.png
          65 kB

            khoand Khoa Nguyen Dang
            timhunt Tim Hunt
            Anupama Sarjoshi Anupama Sarjoshi
            Tim Hunt Tim Hunt
            Ron Carl Alfon Yu Ron Carl Alfon Yu
            Votes:
            2 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 1 hour, 19 minutes
                1h 19m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.