Download & Extend

Analysis tab throws notices for Number components

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

Status:active» needs review

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.

AttachmentSize
webform_number_analysis_notices.patch 2.69 KB

#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

Status:needs review» fixed

Committed to both branches.

#4

Status:fixed» closed (fixed)

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