Leap2a collection pages are in the wrong order
Bug #1482010 reported by
Aaron Wells
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Mahara |
Fix Released
|
Medium
|
Aaron Wells | ||
1.10 |
Fix Released
|
Medium
|
Aaron Wells | ||
1.9 |
Fix Released
|
Medium
|
Aaron Wells | ||
15.04 |
Fix Released
|
Medium
|
Aaron Wells | ||
15.10 |
Fix Released
|
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
no longer affects: | mahara/1.8 |
Changed in mahara: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
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" /> :view8" /> :view11" /> :view10" /> :view7" />
<link rel="has_part" href="portfolio
<link rel="has_part" href="portfolio
<link rel="has_part" href="portfolio
<link rel="has_part" href="portfolio
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.