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.

CommentFileSizeAuthor
#5 webform_grid_values.patch628 bytesquicksketch

Comments

GoofyX’s picture

Is this issue the same as this one?

quicksketch’s picture

Yes, 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?

GoofyX’s picture

I'll have to test the 2.x-dev branch. My initial issue was for the 1.x one.

quicksketch’s picture

I think the code is identical for the grid component between 2.x and 1.x. This solution should work in either version.

quicksketch’s picture

Status: Active » Fixed
StatusFileSize
new628 bytes

I've committed the attached patch (same as the solution above) to both 1.x and 2.x versions. Thanks PWG!

GoofyX’s picture

Yeah, just tried the 1.x-dev version and analysis seems to work fine now.

Thanks, quicksketch! :-)

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.