Leap2a collection pages are in the wrong order

Bug #1482010 reported by Aaron Wells on 2015-08-06
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Medium
Aaron Wells
1.10
Medium
Aaron Wells
1.9
Medium
Aaron Wells
15.04
Medium
Aaron Wells
15.10
Medium
Aaron Wells

Bug Description

If you export a collection to Leap2A and then import it back into Mahara, the pages in the collection will not always be in the same order as they were before the export.

To replicate:

1. Create 5 pages, titled E, D, C, B, and A.
2. Create a collection called "Test collection"
3. Put the 5 pages into the collection, in this order: C, D, A, B, E
4. Export the collection to Leap2A
5. Import the collection back into Mahara

Expected result: You will have a new copy of the collection, with the pages in the order C, D, A, B, E
Actual result: The pages will be in random order

Aaron Wells (u-aaronw) wrote :

This is a bug on the export side. The list of pages in the collection is stored like this in the Leap2A file:

        <link rel="has_part" href="portfolio:view9"/>
        <link rel="has_part" href="portfolio:view8"/>
        <link rel="has_part" href="portfolio:view11"/>
        <link rel="has_part" href="portfolio:view10"/>
        <link rel="has_part" href="portfolio:view7"/>

On import, Mahara simply reads this list back, and adds the pages to the collection in the order they were in the Leap2A file.

The bug is that the SQL query Mahara uses when retrieving the collection-view links, has no "order by" clause on it. So the views are listed in whatever arbitrary order they're returned by the database.

This bug is present at least as far back as Mahara 1.8, and probably earlier. It's a simple fix on the code side, so I'll backport the fix to all currently-supported versions. Unfortunately the fix will not work for already-exported Leap2A files, because they contain no information about how the pages were originally ordered.

Reviewed: https://reviews.mahara.org/5052
Committed: https://git.nzoss.org.nz/mahara/mahara/commit/c10418a135168bad258f83025734f81905073097
Submitter: Aaron Wells (<email address hidden>)
Branch: master

commit c10418a135168bad258f83025734f81905073097
Author: Aaron Wells <email address hidden>
Date: Thu Aug 6 14:15:14 2015 +1200

Import collection pages in the right order (Bug 1482010)

Also, displaying the pages in name order during import.

behatnotneeded: Can't test export & re-import of Leap2a files in Behat yet.

Change-Id: Ib387e574356d9d894b9a6f284b09921a5b26d5fc

Mahara Bot (dev-mahara) wrote :

Patch for "1.10_STABLE" branch: https://reviews.mahara.org/5064

Mahara Bot (dev-mahara) wrote :

Patch for "1.9_STABLE" branch: https://reviews.mahara.org/5065

Reviewed: https://reviews.mahara.org/5063
Committed: https://git.nzoss.org.nz/mahara/mahara/commit/15823ab318839c6871f97fbe31f64e183147ed25
Submitter: Robert Lyon (<email address hidden>)
Branch: 15.04_STABLE

commit 15823ab318839c6871f97fbe31f64e183147ed25
Author: Aaron Wells <email address hidden>
Date: Thu Aug 6 14:15:14 2015 +1200

Import collection pages in the right order (Bug 1482010)

Also, displaying the pages in name order during import.

behatnotneeded: Can't test export & re-import of Leap2a files in Behat yet.

Change-Id: Ib387e574356d9d894b9a6f284b09921a5b26d5fc
(cherry picked from commit c10418a135168bad258f83025734f81905073097)

Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/5064
Committed: https://git.nzoss.org.nz/mahara/mahara/commit/e744d682bcca63846dde8579c8ef9a8760463ad9
Submitter: Robert Lyon (<email address hidden>)
Branch: 1.10_STABLE

commit e744d682bcca63846dde8579c8ef9a8760463ad9
Author: Aaron Wells <email address hidden>
Date: Thu Aug 6 14:15:14 2015 +1200

Import collection pages in the right order (Bug 1482010)

Also, displaying the pages in name order during import.

behatnotneeded: Can't test export & re-import of Leap2a files in Behat yet.

Change-Id: Ib387e574356d9d894b9a6f284b09921a5b26d5fc
(cherry picked from commit c10418a135168bad258f83025734f81905073097)

Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/5065
Committed: https://git.nzoss.org.nz/mahara/mahara/commit/edc608b6244fe50c6cc3df4507f89e21dcc020af
Submitter: Robert Lyon (<email address hidden>)
Branch: 1.9_STABLE

commit edc608b6244fe50c6cc3df4507f89e21dcc020af
Author: Aaron Wells <email address hidden>
Date: Thu Aug 6 14:15:14 2015 +1200

Import collection pages in the right order (Bug 1482010)

Also, displaying the pages in name order during import.

behatnotneeded: Can't test export & re-import of Leap2a files in Behat yet.

Change-Id: Ib387e574356d9d894b9a6f284b09921a5b26d5fc
(cherry picked from commit c10418a135168bad258f83025734f81905073097)

no longer affects: mahara/1.8
Robert Lyon (robertl-9) on 2016-11-06
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers