Moodle

Typo in grade/lib.php causes incorrect sorting

Details

  • Type: Sub-task Sub-task
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.9.2
  • Fix Version/s: 1.9.5
  • Component/s: Gradebook
  • Labels:
    None
  • Database:
    Any
  • Affected Branches:
    MOODLE_19_STABLE
  • Fixed Branches:
    MOODLE_19_STABLE

Description

The following source (from HEAD as of 9/25/2008) contains a typo in line 105 where 'sortfield1' should be 'sortfield2':

102 $ofields = ", u.$this->sortfield1 AS usrt1";
103 $order = "usrt1 $this->sortorder1";
104 if (!empty($this->sortfield2)) { 105 $ofields .= ", u.$this->sortfield1 AS usrt2"; 106 $order .= ", usrt2 $this->sortorder2"; 107 }

The SQL generated by this typo-affected code tries to sort by $this->sortfield1 twice and neglects $this->sortfield2. We didn't notice the problem until one of our instructors encountered it while exporting his gradebook.

This is a one-character fix.

Thanks,
Philip Cali and Adam Zapletal

Activity

Hide
James Rudd added a comment -

One of our teachers experienced this problem, causing issues in Excel mark book comparisons.
I patched the file as specified above and it fixed the sort order problem.

Thanks

Show
James Rudd added a comment - One of our teachers experienced this problem, causing issues in Excel mark book comparisons. I patched the file as specified above and it fixed the sort order problem. Thanks
Hide
Helen Foster added a comment -

Philip, thanks for your report with fix, and James, thanks for your feedback.

Reassigning to Nicolas.

Show
Helen Foster added a comment - Philip, thanks for your report with fix, and James, thanks for your feedback. Reassigning to Nicolas.
Hide
Petr Škoda (skodak) added a comment -

fixed, thanks a lot

Show
Petr Škoda (skodak) added a comment - fixed, thanks a lot
Hide
Nicolas Connault added a comment -

Verified. Thanks!

Show
Nicolas Connault added a comment - Verified. Thanks!

People

Dates

  • Created:
    Updated:
    Resolved: