Posted by quicksketch on March 10, 2012 at 4:14am
2 followers
| Project: | Webform |
| Version: | 7.x-3.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
After adding a number component to a form, the Results -> Analysis tab throws 2 PHP notices per number component:
Notice: Undefined variable: average in _webform_analysis_number() (line 403 of /Users/nate/Sites/drupal7/sites/all/modules/webform/components/number.inc).
Notice: Undefined variable: average_title in _webform_analysis_number() (line 410 of /Users/nate/Sites/drupal7/sites/all/modules/webform/components/number.inc).
Comments
#1
This patch corrects the problem by always executing the conditionals for "Average and population count", even if there aren't any values. This sets the variables for $average and $average_title. To avoid divide-by-zero errors, I added an extra check before calculating the averages.
#2
Oh, this patch also solves the "User entered value" being inaccurate, since a user making a submission is not the same as submitting a value if they left the field blank.
#3
Committed to both branches.
#4
Automatically closed -- issue fixed for 2 weeks with no activity.