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).
Files: 

Comments

Status:Active» Needs review
StatusFileSize
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.

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.

Status:Needs review» Fixed

Committed to both branches.

Status:Fixed» Closed (fixed)

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