Moodle
  1. Moodle
  2. MDL-19114

Teachers are unable to view answers to essay questions

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.9.4
    • Fix Version/s: 1.9.8
    • Component/s: Quiz
    • Labels:
      None
    • Environment:
      PHP 5.2.8 on Apache 2/RedHat Linux. MSSQL backend on IIS.
    • Database:
      Microsoft SQL
    • Difficulty:
      Moderate
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE

      Description

      When a teacher goes to view the answers to essay questions in a quiz, they can't see the student's answer when they first pull up the page (e.g. /mod/quiz/reviewquestion.php?state=1031944&number=53 ).

      However, if they click on the edit button (on the upper left), and then click cancel on the following page, the answer is then shown. I tried debugging the script, but haven't been able to find where the essay answers are being loaded, and why they wouldn't be loaded initially.

      I've attached a couple of screenshots to illustrate the problem.

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            Lucian DiPeso added a comment -

            I found if I changed the function quiz_get_newgraded_states() (in /mod/quiz/report/reportlib.php) SQL from:

            $gradedstatesql = "SELECT $fields FROM " .
            "{$CFG->prefix}question_sessions qns, " .
            "{$CFG->prefix}question_states qs " .
            "WHERE qns.attemptid IN ($attemptidlist) AND " .
            "qns.newgraded = qs.id";

            to

            $gradedstatesql = "SELECT $fields FROM " .
            "{$CFG->prefix}question_sessions qns, " .
            "{$CFG->prefix}question_states qs " .
            "WHERE qns.attemptid IN ($attemptidlist) AND " .
            "qns.newest = qs.id";

            It fixes the problem. However, the function is named quiz_getnewgraded_states, which makes me think it's supposed to return values based on the newgraded column, not the newest column, so I'm hesitant to submit this change back.

            Show
            Lucian DiPeso added a comment - I found if I changed the function quiz_get_newgraded_states() (in /mod/quiz/report/reportlib.php) SQL from: $gradedstatesql = "SELECT $fields FROM " . "{$CFG->prefix}question_sessions qns, " . "{$CFG->prefix}question_states qs " . "WHERE qns.attemptid IN ($attemptidlist) AND " . "qns.newgraded = qs.id"; to $gradedstatesql = "SELECT $fields FROM " . "{$CFG->prefix}question_sessions qns, " . "{$CFG->prefix}question_states qs " . "WHERE qns.attemptid IN ($attemptidlist) AND " . "qns.newest = qs.id"; It fixes the problem. However, the function is named quiz_getnewgraded_states, which makes me think it's supposed to return values based on the newgraded column, not the newest column, so I'm hesitant to submit this change back.
            Hide
            Tim Hunt added a comment -

            This may be the same underlying cause as MDL-9327, and your suggested fix is essentially the same as the proposed fix there.

            I am inclined to think that both fixes are correct. However, it would be nice to have more testing before committing to a stable branch.

            Show
            Tim Hunt added a comment - This may be the same underlying cause as MDL-9327 , and your suggested fix is essentially the same as the proposed fix there. I am inclined to think that both fixes are correct. However, it would be nice to have more testing before committing to a stable branch.
            Hide
            John Ennew added a comment -

            We came across this problem at our institution. I've applied the fix on my dev systems and run a number of tests in single and multiple attempt situations and they all seem to work. I'm going to roll this out to test this week and to live at the end of this month. I'll come back in March to report on success or failures.

            Show
            John Ennew added a comment - We came across this problem at our institution. I've applied the fix on my dev systems and run a number of tests in single and multiple attempt situations and they all seem to work. I'm going to roll this out to test this week and to live at the end of this month. I'll come back in March to report on success or failures.
            Hide
            Tim Hunt added a comment -

            Thanks for the update. Let me know how it goes. It would be nice to get this into 1.9.x if it works reliably.

            Show
            Tim Hunt added a comment - Thanks for the update. Let me know how it goes. It would be nice to get this into 1.9.x if it works reliably.
            Hide
            Stephen added a comment -

            Have just been testing this fix on our test server, and it fixes the problem and doesn't break anything else (that we know of).

            Show
            Stephen added a comment - Have just been testing this fix on our test server, and it fixes the problem and doesn't break anything else (that we know of).
            Hide
            Tim Hunt added a comment -

            Thanks for your feedback everyone. Having thought about this some more, and given the above comments, I have decided to commit this to CVS.

            Please let me know if anything breaks.

            Show
            Tim Hunt added a comment - Thanks for your feedback everyone. Having thought about this some more, and given the above comments, I have decided to commit this to CVS. Please let me know if anything breaks.

              People

              • Votes:
                2 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: