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/
Notice: Undefined variable: average_title in _webform_analysis_number() (line 410 of /Users/nate/Sites/drupal7/sites/all/modules/webform/components/


quicksketch’s picture

Status:Active» Needs review
new2.69 KB

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.

quicksketch’s picture

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.

quicksketch’s picture

Status:Needs review» Fixed

Committed to both branches.

Status:Fixed» Closed (fixed)

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