Moodle

Sortorder incorrectly updated leading to interface failure

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.8.4, 1.8.5, 1.9
  • Fix Version/s: 2.0
  • Component/s: Other
  • Labels:
    None
  • Environment:
    Debian Etch PHP Version 5.2.0-8+etch7
  • Database:
    MySQL
  • Affected Branches:
    MOODLE_18_STABLE, MOODLE_19_STABLE
  • Fixed Branches:
    MOODLE_20_STABLE

Description

I have an installation which when using the page /course/category.php to reorder courses, when you click on the arrows to change the order of a course the page refreshes but nothing else happens. On investigation this seems to be due to the sortorder value in the mdl_course table being set to the maximum allowed for an int field, ie 4294967295.

I reset the values to 1,2,3 and 4 and then tried the arrows buttons again and the values did not change as I had expected, ie the values swapped around but 1000 was added to each value, eg they changed to 1001, 1002 etc. Use one of the arrow buttons again and 1000 was added. E.g. 2001, 2002 etc

I then tried with a set of courses on another installation which I hadn't fiddled with whose values were 13005, 13006 and 13007, I then used the reordering buttons and they changed to 14006, 14005, 14007.

I accept that a user will have to re-order courses quite a few times to reach the int field maximum, but somehow on this site they have. I don't understand why Moodle is adding 1000 to each number, surely it only has to swap the existing values around.

Thanks

Richard

Issue Links

Activity

Hide
Petr Škoda (skodak) added a comment -

sending a patch that should have much better perf and solve the out of bounds issue too, only for HEAD though

Show
Petr Škoda (skodak) added a comment - sending a patch that should have much better perf and solve the out of bounds issue too, only for HEAD though
Hide
Petr Škoda (skodak) added a comment -

fresh new patch for HEAD - not much tested though

Show
Petr Škoda (skodak) added a comment - fresh new patch for HEAD - not much tested though
Hide
Eloy Lafuente (stronk7) added a comment -

After some discussing with Petr, everything seems to be clearly implemented in the patch. My +1 after some testing.

Also, I think we should try to backport this to 1.9 at least, because there are some reports about getting out of ints space in various bugs. It cannot be backported automatically, but should do that.

Ciao

Show
Eloy Lafuente (stronk7) added a comment - After some discussing with Petr, everything seems to be clearly implemented in the patch. My +1 after some testing. Also, I think we should try to backport this to 1.9 at least, because there are some reports about getting out of ints space in various bugs. It cannot be backported automatically, but should do that. Ciao
Hide
Petr Škoda (skodak) added a comment -

sending latest patch with several fixes and improved perf

Show
Petr Škoda (skodak) added a comment - sending latest patch with several fixes and improved perf
Hide
Petr Škoda (skodak) added a comment -

should be fixed in HEAD, going to create a clone issue for backporting,
thanks for the report

Show
Petr Škoda (skodak) added a comment - should be fixed in HEAD, going to create a clone issue for backporting, thanks for the report

People

Vote (0)
Watch (3)

Dates

  • Created:
    Updated:
    Resolved: