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

Sorting submitted assignments by status makes all assignments disappear

XMLWordPrintable

    • MySQL
    • MOODLE_18_STABLE
    • MOODLE_17_STABLE, MOODLE_18_STABLE, MOODLE_19_STABLE

      When looking at the list of assignments (by "View ... submitted assignments"), press "status" to sort by status. All records disappear.

      Reason: SQL query generated to sort by status is invalid. It looks like

      SELECT u.id, u.firstname, u.lastname, u.picture, s.id AS submissionid, s.grade, s.submissioncomment, s.timemodified, s.timemarked FROM mdl_user u LEFT JOIN mdl_assignment_submissions s ON u.id = s.userid AND s.assignment = 1 WHERE u.id IN (3,4) ORDER BY status ASC, lastname ASC

      So "status" is used in "order by", but it doesn't exist in returned set. It worked in moodle 1.6.x. I have a strong feeling that this bug is caused by incorrectly fixing #8164 ("MS SQL cannot return Boolean data type in query results, any code using this returns no results when using Sql 2005"). Looks like when fixing #8164, status field was removed from SQL clauses, but it's still needed there for sorting.

      To fix this on our moodle installation we used the attached patch. Basically, it adds again the SQL code that was already in moodle 1.6. So careless applying it will probably break #8164 again... The patch is only safe for people that run on database that can handle such SQL, like MySQL. The correct solution is probably to make a better fix to #8164.

        1. a.patch
          1 kB
          Michalis Kamburelis

            stronk7 Eloy Lafuente (stronk7)
            kambi Michalis Kamburelis (Inactive)
            Nobody Nobody (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

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