There seems to be a bug in grid.inc. The report/analysis reports 0 counts for questions in which the option keys and option description are not the same.
EXAMPLE OF GRID QUESTION THAT WILL RETURN CORRECT COUNT
Question 1 : How many cars have you had?
1|1
2|2
3|3
4|4
EXAMPLE OF GRID QUESTION THAT WILL RETURN INCORRECT COUNT (0)
Question 1 : How many cars have you had?
1|None of your business
2|Don't remember...
3|None, I don't like cars
4|None that I haven't wrecked
(Yes, in this case I use the grid for one single question but the problem is the same with multi-question grids.)
The problem lies within _webform_analysis_rows_grid around row 275 in grid.inc.
Replacing
$row[] = !empty($counts[$qkey][$option]) ? $counts[$qkey][$option] : 0;
with
$row[] = !empty($counts[$qkey][$okey]) ? $counts[$qkey][$okey] : 0;
seems take care of the immediate problem. I don't have so much time right now so I leave to someone who knows the webform module better to put the icing on the cake on this fix.
Petter
P.S. Yes, the problem is also in 5.x-2.0-beta1.
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | webform_grid_values.patch | 628 bytes | quicksketch |
Comments
Comment #1
GoofyX commentedIs this issue the same as this one?
Comment #2
quicksketchYes, looks like the same problem, but it looks like this might be the solution. I didn't try using key|value pairs in my testing at all. GoofyX, does this solution fix the problem for you also?
Comment #3
GoofyX commentedI'll have to test the 2.x-dev branch. My initial issue was for the 1.x one.
Comment #4
quicksketchI think the code is identical for the grid component between 2.x and 1.x. This solution should work in either version.
Comment #5
quicksketchI've committed the attached patch (same as the solution above) to both 1.x and 2.x versions. Thanks PWG!
Comment #6
GoofyX commentedYeah, just tried the 1.x-dev version and analysis seems to work fine now.
Thanks, quicksketch! :-)
Comment #7
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.