I have just upgraded LimeSurvey from version 1.91 to 2.05b4. After the upgrade, the stats data wasn’t displayed correctly – even though all data was stored correctly in the database. For the count, I always got zero values.

 

zeroValues

While debugging, I have noticed some strange SQL queries:

[18:33:08.792][trace][system.db.CDbCommand] Querying SQL: SELECT count(*) FROM lime_survey_55836 WHERE `55836X2X122` = 'A1' AND NULL

… AND NULL?

The query is generated wrong. The correct query should be:

SELECT count(*) FROM lime_survey_55836 WHERE `55836X2X122` = 'A1'

Bugfix:

Page:

application/helpers/admin/statistics_helper.php

On line 3088:

if (!isset($sql) || !$sql) {$sql="NULL";}

replace with:

if (!isset($sql) || !$sql) {$sql=NULL;}

tadaaaaaaaaaa – now it’s working correctly!

limesurvey stats fixed

phew…. 😛