Login Form

#124 – stats from checkbox not showing _OTHERS_ value

Posted in ‘BF Survey’
This is a public ticket. Everybody will be able to see its contents. Do not include usernames, passwords or any other sensitive information.
Sunday, 09 February 2014 07:11 AEDT
Joomla! version: 2.5.17

Hi, I bought and installed BF Survey Plus last week and it is working fine except for a little detail:
I made a checkbox question including the _OTHER_ option. Works nicely and values filled into the _OTHER_ box are showing up in the results and reports.
Only when I am looking at the stats, the count and percentage for _OTHER_ always remain zero.
I had a look at the function getStatsCheckbox in the controller.php and it seems to me that the query in line 205 is not working properly.
$query->where($db->escape( $question ) .' like '.$db->quote('%'.$db->escape( $response, true ).'%') );
This query works fine for all normal options but if $response = "_OTHER_" the query shows up like this:
SELECT * FROM `#__bfsurveyplus_10` WHERE affiniteit like '%\\_OTHER\\_%'

Looks to me it the underscore has to be escaped someway or the _OTHER_ field should be counted separately...

Best regards from a Dutchman in France ;)
Monday, 10 February 2014 22:42 AEDT 5'
BF Quiz Plus 3 Years
Hi Johan,
I've been able to reproduce this on my test site and confirm there is a bug. There are actually two issues, firstly the default mutlipage view was storing _OTHER_ in the results table rather than the additional text typed in by the user. Secondly, there was an issue with the query that obtained the stats for the _OTHER_ option. Both issues are hopefully now fixed in v1.1.15, can you please try this new version and let me know if you still have an issue.


Follow us on twitter http://twitter.com/tamlynsoftware
Tuesday, 11 February 2014 07:38 AEDT
Hi Tim,
thank you for your quick reply and updates version. Unfortunately it did not solve my problem. I forgot to mention that I used a one-page survey and there the additional text typed in at the _OTHER_ field was already stored in the results table.

I looked a bit further and found a solution:
When I looked at the stats for the checkbox-type I noticed that only the getstatscheckbox() function was called and not the getstatsother() function.

So I went to the views/stats/tmpl/default.php line 90.
There I made the code similar to the code in line 95-100 but changed getstats() in getstatscheckbox(). Did the same in the administrator section and this seems to work well.

I am sorry you have to publish another version again...

Best regards Johan
Tuesday, 11 February 2014 07:50 AEDT
Hi again Tim,

I forgot to mention that I found another small issue with the stats (but maybe it's better to open another ticket?)
Anyway: When you open the results-page you get a list of all the records, when you select some records and move them to the trash-bin they disappear from the results list (status -2 in the database).
Unfortunately they still show up in the stats (and in the reports but there you can see the status).

Greetings from France, Johan

Wednesday, 12 February 2014 21:38 AEDT 10'
BF Quiz Plus 3 Years
Thanks Johan, I'll make this change for the next version.

With regards to deleted records, they should have a state of -2, and in both the getStatsCheckbox and getStats functions there is a line in the query
$query->where('(state IN (0, 1))');

This should only show published (1) and unpublished(0) results, not deleted (-2) ones. Perhaps this should be changed to:

so that it only shows published records. Are you able to try that minor change and see if it solves the problem?


Follow us on twitter http://twitter.com/tamlynsoftware
This ticket is closed, therefore read-only. You can no longer reply to it. If you need to provide more information, please open a new ticket and mention this ticket's number.
Go to top