Uploaded image for project: 'Plugins'
  1. Plugins
  2. CONTRIB-5284

order of subquestions in report of ranked question varies

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.6.4, 2.7
    • Fix Version/s: 2.6.4, 2.7
    • Component/s: Module: Questionnaire
    • Labels:
      None
    • Affected Branches:
      MOODLE_26_STABLE, MOODLE_27_STABLE
    • Fixed Branches:
      MOODLE_26_STABLE, MOODLE_27_STABLE

      Description

      A ranked question has two report tables one showing the average results and showing the absolute and relative values. The responses in both tables might vary. e.g. first response is third response in second result table.
      This is observed on a postgresql database and occurs due to a missing order by statement:

      --- a/mod/questionnaire/questiontypes/questiontypes.class.php
      +++ b/mod/questionnaire/questiontypes/questiontypes.class.php
      @@ -587,7 +589,9 @@ class questionnaire_question {
                                    (SELECT c2.id, AVG(a2.rank+1) AS average, COUNT(a2
                                     FROM {questionnaire_quest_choice} c2, {$CFG->pref
                                     WHERE c2.question_id = ? AND a2.question_id = ? A
      -                              GROUP BY c2.id) a ON a.id = c.id";
      +                              GROUP BY c2.id) a ON a.id = c.id
      +                        order by c.id
      +                        ";
                       $results = $DB->get_records_sql($sql, array($this->id, $this->i
                       if (!empty ($rankvalue)) {
                           foreach ($results as $key => $result) {
      

        Attachments

          Activity

            People

            Assignee:
            rezeau Joseph Rézeau
            Reporter:
            super3d Claus A. Us.
            Participants:
            Component watchers:
            Mike Churchward
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Fix Release Date:
              12/May/14