Error when adding a Group pages block onto a group home page

Bug #1396565 reported by Dominique-Alain JAN on 2014-11-26
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Mahara
Critical
Robert Lyon
1.10
Critical
Robert Lyon
15.04
Critical
Robert Lyon

Bug Description

To replicate on Mahara 15.04dev

1/ Create a group or go to an already create group
2/ Edit the home page
3/ Add the bloc "Group page"

You get the error : _record_sql found more than one row. If you meant to retrieve more than one record, use get_records_*, otherwise check your code or database for inconsistencies

Tried on three different platforms with 15.04dev

Changed in mahara:
milestone: none → 15.04.0
importance: Undecided → Critical
Robert Lyon (robertl-9) wrote :

The problem is the system allows a user to add a group pages block when there is already one on the page but there should only be one on a page - this causes the sql problem/error.

Need to add a check to see if the block exists on the page and alert the user to this fact.

Changed in mahara:
assignee: nobody → Robert Lyon (robertl-9)
Robert Lyon (robertl-9) wrote :

Like the way the feedback block works - if you try to add more than one it alerts you to the problem

Robert Lyon (robertl-9) wrote :

ah my assumptions are wrong - in 1.8 and 1.9 one can have multiple 'group pages' blocks on the homepage

but in 1.10 and 15.04 it causes the error.

so will need to find out what changed and why the error

Robert Lyon (robertl-9) on 2014-11-27
Changed in mahara:
status: New → In Progress

Robert fixed it so that you can only add 1 block to the group homepage. If you upgraded your site from pre 1.10, the upgrade script will look at the settings of all the group pages blocks that were on the group homepage and merges their settings.

Therefore, there are a few different test scenarios to test:

1. Fresh Mahara install: You can only add one "Group pages" block to the group homepage. (also Behat test)

2. Fresh Mahara install: Check that you can't add a second "Group pages" block to the group pages template page in Administration -> Configure site -> Pages.

3. Upgrade from Mahara 1.9 to 15.04 master with only one "Group pages" block on the group homepage.
- choose some non-default settings
- have 5 pages shared with the group by another user
- ensure that the chosen settings are still applied after the upgrade
- check that you can only add one "Group pages" block to the group homepage after the upgrade
- after the upgrade, change the "Entries per page" setting to 3 and check that the paginator works.

4. Upgrade from Mahara 1.9 to 15.04 with a minimum of "Group pages" blocks on the group homepage (there are 3 possible combinations that make sense: Yes - No, No - Yes, Yes - Yes) . Set up 3 different groups to test various combinations of the settings and also choose different group types (1 open, 1 controlledallowing submissions, 1 request). Do a 4th test where one block is set to No-No and another to either Yes-No or No-Yes just to check the negative works as well.
- have 5 pages by another user shared with the group and 5 pages submitted to the group if it is a group that allows submissions
- ensure that the chosen settings are merged after the upgrade. Note down which settings result so it can be double-checked that this is the expected behavior.
- check that you can only add one "Group pages" block to the group homepage after the upgrade
- after the upgrade, change the "Entries per page" setting to 3 and check that the paginator works and that all the pages that were displayed before the upgrade still show up after in their respective categories. Also log in as the other user in the group that allowed submissions to also check that you can only see any pages that have been shared with the group but not ones that have been submitted.

Eduardo (o-eduardo) wrote :

Full testing method on attached file.

Reviewed: https://reviews.mahara.org/4041
Committed: http://gitorious.org/mahara/mahara/commit/7d6192f81f1219c1f4a6bed3c606ccf886671e8e
Submitter: Son Nguyen (<email address hidden>)
Branch: master

commit 7d6192f81f1219c1f4a6bed3c606ccf886671e8e
Author: Robert Lyon <email address hidden>
Date: Thu Nov 27 14:33:50 2014 +1300

Fixing up group homepage problem (Bug #1396565)

A mistake was made where a user was allowed to add more than one
"group pages" block to the group homepage. This wasn't a problem until
we added pagination to the "group pages" block.

This patch attempts to clean up that error and merge any existing
multiple block instances into one "group pages" block instance.

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

So, we've got a fix for this in master, part of which is that it consolidates multiple blocks into a single block.

But I would prefer not to backport that data-changing fix to 1.10. Minor releases shouldn't be making changes to user data like that. Is it possible to come up with some other solution, for 1.10?

Robert Lyon (robertl-9) wrote :

Any other fix would get very complicated.

Even if we fixed the immediate issue: 'get_record_sql found more than one row.'
and allowed the group_get_homepage_view_groupview_block() to return more than one block instance there would be the a subsequent fail of the pagination not working as it won't know which groupviews block to work with.

Normally I'd not be keen to alter people's data on a backport but seeing as:
1) The current state is wrong due to an earlier commit mistake. So this is a regression rather than a change.
2) An alternate fix will be overly complicated (yet temporary once one upgrades to 15.04)
3) The data being merged/retained is boolean choices rather than text string/file/image data so little (if anything) will be lost.
4) The numbers of users this effects will be very small (36 views out of 14050 grouphomepage views on large client site, ie 0.25%)

I'd be happy to use the current fix for 1.10 in this particular instance

Aaron Wells (u-aaronw) wrote :

Very well, let's go ahead with the backport then.

Reviewed: https://reviews.mahara.org/4099
Committed: http://gitorious.org/mahara/mahara/commit/c1f8e419b67fcce296e082566aa7a85319399d92
Submitter: Aaron Wells (<email address hidden>)
Branch: 1.10_STABLE

commit c1f8e419b67fcce296e082566aa7a85319399d92
Author: Robert Lyon <email address hidden>
Date: Thu Nov 27 14:33:50 2014 +1300

Fixing up group homepage problem (Bug #1396565)

A mistake was made where a user was allowed to add more than one
"group pages" block to the group homepage. This wasn't a problem until
we added pagination to the "group pages" block.

This patch attempts to clean up that error and merge any existing
multiple block instances into one "group pages" block instance.

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

summary: - Error when adding a Group pages bloc onto a group home page
+ Error when adding a Group pages block onto a group home page
MarkPea (markhpearson) wrote :

I got exactly this error (Mahara v10.1) :

[Tue Feb 17 11:20:19.322967 2015] [:error] [pid 23531:tid 34622944256] [client 159.28.7.70:50895] [WAR] 48 (lib/errors.php:745) get_record_sql found more than one row. If you meant to retrieve more than one record, use get_records_*, otherwise check your code or database for inconsistencies, referer: https://mahara.earlham.edu/view/groupviews.php?group=13
[Tue Feb 17 11:20:19.323077 2015] [:error] [pid 23531:tid 34622944256] [client 159.28.7.70:50895] [WAR] 48 (lib/dml.php:324) get_record_sql found more than one row. If you meant to retrieve more than one record, use get_records_*, otherwise check your code or database for inconsistencies, referer: https://mahara.earlham.edu/view/groupviews.php?group=13

I made the same mistake with two separate groups! Here's why :

I have a Group which maps to a subject Major at University (Sociology/Anthropology). They are exploring (with lots of my help) using Mahara for student eportfolios and assessment of the whole programme. The group is Controlled and students 'submit' Pages to be commented upon by Tutors -- a very neat system by the way. With this in mind I wanted to display 'Submissions to this group' at the top of the Group Pages so that new submissions would be right in the face of Tutors accessing the Group site. However, the order of display within the Group Page block is fixed -- no matter I thought, just add another instance of Group Pages with all the other options unchecked and submissions checked. WRONG! I managed to make exactly this same mistake TWICE!

How can I retrieve the situation? Currently using v10.1 the About page throws the error and does not allow the Group to be deleted. I have two of these Groups that are currently useless. Does 10.2 allow me to edit the About page and remove the offending block or even delete the group and start from scratch ?

MarkPea (markhpearson) wrote :

Apologies -- I've just read the comment above which pre-answers my question :-)

This patch attempts to clean up that error and merge any existing multiple block instances into one "group pages" block instance.

Voila! C'est magnifique!

Hello Mark. Thanks for the confirmation that the 1.10 patch works for you. :-)

Robert Lyon (robertl-9) on 2015-04-17
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