Block order numbers out of sync with number of blocks in a cell

Bug #1528351 reported by Robert Lyon
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
High
Robert Lyon
1.10
Fix Released
High
Unassigned
15.04
Fix Released
High
Unassigned
15.10
Fix Released
High
Unassigned

Bug Description

Due to Bug #1523719 there can exist a mismatch problem between the count of blocks in a page cell and the maximum order number of said blocks, eg you can have either a first block not being at order position 1 or have gaps in order rank, eg 1,2,4 etc, like this:

   id | view | row | column | order | maxorder | countorder
----------+---------+-----+----------+--------+---------------+--------
  10537 | 2754 | 1 | 4 | 3 | 3 | 1
  22486 | 6616 | 1 | 2 | 1 | 4 | 3
  22487 | 6616 | 1 | 2 | 2 | 4 | 3
  22490 | 6616 | 1 | 2 | 4 | 4 | 3

We need a sql query to find these problems and have an update to fix the problem areas in the database.

Here is a query to find the problem cells:

SELECT b.id, b.view, b.row, b.column, b.order,maxorder,countorder FROM block_instance b JOIN
(SELECT view AS sview, "row" AS srow, "column" AS scol, COUNT("order") AS countorder, MAX("order") AS maxorder FROM block_instance GROUP BY view, "row", "column") AS myview ON myview.sview = b.VIEW AND myview.srow = b.row AND myview.scol = b.column
WHERE maxorder != countorder
ORDER BY b.view, b.row, b.column, b.order;

Revision history for this message
Robert Lyon (robertl-9) wrote :

Marking this as high as it's a missing part of the fix for Bug 1523719, which has already been merged

Changed in mahara:
status: New → In Progress
importance: Undecided → High
assignee: nobody → Robert Lyon (robertl-9)
milestone: none → 16.04.0
Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "master" branch: https://reviews.mahara.org/5862

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/5862
Committed: https://git.mahara.org/mahara/mahara/commit/7fbc667b2b6d583e776310360edf301a406b2225
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit 7fbc667b2b6d583e776310360edf301a406b2225
Author: Robert Lyon <email address hidden>
Date: Tue Dec 22 10:43:57 2015 +1300

Bug 1528351: Fixing block order drift in database

Due to a mistake in how blocks were ordered in the system

behatnotneeded - existing tests should be ok

Change-Id: Iac857c85d60e5948b6f95ddccee7a2e8cf43b1b4
Signed-off-by: Robert Lyon <email address hidden>

Robert Lyon (robertl-9)
Changed in mahara:
status: In Progress → Fix Committed
Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "15.10_STABLE" branch: https://reviews.mahara.org/6107

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/6107
Committed: https://git.mahara.org/mahara/mahara/commit/bad81b1fc995fe7120ee89aebd67cd9933c39ff6
Submitter: Robert Lyon (<email address hidden>)
Branch: 15.10_STABLE

commit bad81b1fc995fe7120ee89aebd67cd9933c39ff6
Author: Robert Lyon <email address hidden>
Date: Tue Dec 22 10:43:57 2015 +1300

Bug 1528351: Fixing block order drift in database

Due to a mistake in how blocks were ordered in the system

behatnotneeded - existing tests should be ok

Change-Id: Iac857c85d60e5948b6f95ddccee7a2e8cf43b1b4
Signed-off-by: Robert Lyon <email address hidden>

Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "15.04_STABLE" branch: https://reviews.mahara.org/6109

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/6109
Committed: https://git.mahara.org/mahara/mahara/commit/4251b9834fe13256adafbea700f037d65694177d
Submitter: Robert Lyon (<email address hidden>)
Branch: 15.04_STABLE

commit 4251b9834fe13256adafbea700f037d65694177d
Author: Robert Lyon <email address hidden>
Date: Tue Dec 22 10:43:57 2015 +1300

Bug 1528351: Fixing block order drift in database

Due to a mistake in how blocks were ordered in the system

behatnotneeded - existing tests should be ok

Change-Id: Iac857c85d60e5948b6f95ddccee7a2e8cf43b1b4
Signed-off-by: Robert Lyon <email address hidden>

Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

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

Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/6110
Committed: https://git.mahara.org/mahara/mahara/commit/142faacc5fcef09b6a05cf074c21e738d8a74982
Submitter: Robert Lyon (<email address hidden>)
Branch: 1.10_STABLE

commit 142faacc5fcef09b6a05cf074c21e738d8a74982
Author: Robert Lyon <email address hidden>
Date: Tue Dec 22 10:43:57 2015 +1300

Bug 1528351: Fixing block order drift in database

Due to a mistake in how blocks were ordered in the system

behatnotneeded - existing tests should be ok

Change-Id: Iac857c85d60e5948b6f95ddccee7a2e8cf43b1b4
Signed-off-by: Robert Lyon <email address hidden>

Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.