View Issue Details

This bug affects 1 person(s).
 12
IDProjectCategoryView StatusLast Update
08538Bug reportsResponse browsingpublic2014-01-16 16:45
Reporterafonsocosta Assigned ToDenisChenu  
PrioritynormalSeverityminor 
Status closedResolutionfixed 
Product Version2.05+ 
Fixed in Version2.05+ 
Summary08538: Problem with array (numbers) questions
Description

Whenever I add questions Array type (numbers) have a problem. When the survey is on-line the last question type array (numbers) is red like an error.

TagsNo tags attached.
Attached Files
problem.jpg (358,747 bytes)
patch08538.diff (2,039 bytes)   
diff --git a/application/helpers/expressions/em_manager_helper.php b/application/helpers/expressions/em_manager_helper.php
index faacc24..7551435 100644
--- a/application/helpers/expressions/em_manager_helper.php
+++ b/application/helpers/expressions/em_manager_helper.php
@@ -1341,6 +1341,7 @@
                         if ($hasSubqs) {
                             $subqs = $qinfo['subqs'];
                             $sq_equs=array();
+                            $subqValidEqns = array();
                             foreach($subqs as $sq)
                             {
                                 $sq_name = ($this->sgqaNaming)?$sq['rowdivid'].".NAOK":$sq['varName'].".NAOK";
@@ -1675,6 +1676,7 @@
                             if ($hasSubqs) {
                                 $subqs = $qinfo['subqs'];
                                 $sq_equs=array();
+                                $subqValidEqns = array();
                                 foreach($subqs as $sq)
                                 {
                                     $sq_name = ($this->sgqaNaming)?substr($sq['jsVarName'],4).".NAOK":$sq['varName'].".NAOK";
@@ -2446,6 +2448,7 @@
                             if ($hasSubqs) {
                                 $subqs = $qinfo['subqs'];
                                 $sq_equs=array();
+                                $subqValidEqns=array();
                                 foreach($subqs as $sq)
                                 {
                                     $sq_name = ($this->sgqaNaming)?$sq['rowdivid'].".NAOK":$sq['varName'].".NAOK";
@@ -2481,6 +2484,7 @@
                             if ($hasSubqs) {
                                 $subqs = $qinfo['subqs'];
                                 $sq_equs=array();
+                                $subqValidEqns=array();
                                 foreach($subqs as $sq)
                                 {
                                     $sq_name = ($this->sgqaNaming)?substr($sq['jsVarName'],4).".NAOK":$sq['varName'].".NAOK";
patch08538.diff (2,039 bytes)   
Bug heat12
Complete LimeSurvey version number (& build)140109
I will donate to the project if issue is resolvedNo
BrowserGoogle Chrome
Database type & versionMy SQL
Server OS (if known)Linux Appolo
Webserver software & version (if known)CPanel Accelareted 2
PHP Version5.3.19

Users monitoring this issue

afonsocosta

Activities

c_schmitz

c_schmitz

2014-01-14 14:22

administrator   ~27851

I cannot reproduce this at all with your survey. Please reduce the survey to a minimum test case and attach it again - thank you.

afonsocosta

afonsocosta

2014-01-14 14:27

reporter   ~27853

Hi!

I attached a new survey with only two questions.

Thank you

DenisChenu

DenisChenu

2014-01-14 14:31

developer   ~27854

Last edited: 2014-01-14 14:32

Understand: You set "minimum value" to 1 : then all empty answer are in error. (and your last question is Mandatory : then each text input need an answer).

c_schmitz

c_schmitz

2014-01-14 14:39

administrator   ~27855

Last edited: 2014-01-14 14:40

DenisChenu: He means the default state of the reponse before you enter or submit anything
The boxes of the last question are colored differently. I copied the first question to last and the problem persists with the last displayed question.

afonsocosta

afonsocosta

2014-01-14 14:39

reporter   ~27856

Why it happens only in the last question of the survey even before I started to answering the survey?

c_schmitz

c_schmitz

2014-01-14 14:44

administrator   ~27857

Tony, this seems to be JS/EM related - can you take a look, please?

DenisChenu

DenisChenu

2014-01-14 15:05

developer   ~27858

Yes, something bad here : the 1st one must be on error too.

afonsocosta

afonsocosta

2014-01-14 15:06

reporter   ~27859

Sory, I'm not and advenced user of limesurvey. Where I can see more about JS/EM related?

tpartner

tpartner

2014-01-14 17:08

partner   ~27861

Last edited: 2014-01-14 17:09

This is not a JavaScript problem directly. It's more of a PHP logic problem in em_manager_helper.php.

em_manager_helper.php is generating completely different LEMval[qID]() functions for the questions depending on their placement.

I also noticed that the problem only seems to occur if the question is mandatory.

I'm afraid someone with a bigger PHP brain than me will have to pick this up.

c_schmitz

c_schmitz

2014-01-14 17:19

administrator   ~27863

That must be mdekker ;)

DenisChenu

DenisChenu

2014-01-14 18:04

developer   ~27864

Think i got it, see patch @mdekker.

c_schmitz

c_schmitz

2014-01-14 21:25

administrator   ~27868

Denis, looks fine to me - please apply.

mdekker

mdekker

2014-01-15 09:13

reporter   ~27870

@DenisChenu Checked the code and it seems you have found all the missing initializations. Nice job!

Ok I know this will come back like a boomerang ;-)

[rant on]
This method is about 2000 lines of code, that is way too big for a method. The result is errors like this. I feel this could be split up in smaller pieces of code that are easier to read and reduce the risk of this kind of errors. When it is refactored properly, the changes needed when transitioning to question objects should be easier and less error prone too. Also the em_manager_helper is a beast with almost 9700 lines of code. Some of them really don't need to be in this class like TSV export, unit tests etc. Since EM is the heart of the application at the moment, I feel it would be good to take it apart and (re)move all we don't need and split up the parts that are to big. This will make debugging a lot easier.
[/rant off]

afonsocosta

afonsocosta

2014-01-15 09:55

reporter   ~27873

Thanks for all the support. I will try to change the em_manager_helper.php file.

DenisChenu

DenisChenu

2014-01-15 10:00

developer   ~27874

Last edited: 2014-01-15 10:01

@mdekker : for 2.1 : we need a global "EM" set by attribute else we can not extend attribute in Plugin.

1st step is to refactor function _CreateSubQLevelRelevanceAndValidationEqns

I think we need some global var at start and find a way to prefill some var to , used by all/lot of part after ($sq_names[] first i think).

Hard job here ... and EM have a lot of SQL expression too (need to be replaced by Yii model).

DenisChenu

DenisChenu

2014-01-15 11:29

developer   ~27877

Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=13690

c_schmitz

c_schmitz

2014-01-16 16:45

administrator   ~27910

2.05+ Build 140116 released

Related Changesets

LimeSurvey: master 24d33028

2014-01-15 10:29:08

DenisChenu

Details Diff
Fixed issue 08538: Problem with array (numbers) questions error information
Dev: Fix multi javascript testing for error/good
Affected Issues
08538
mod - application/helpers/expressions/em_manager_helper.php Diff File

Issue History

Date Modified Username Field Change
2014-01-14 12:22 afonsocosta New Issue
2014-01-14 12:22 afonsocosta File Added: limesurvey_survey_582171 (1).lss
2014-01-14 12:53 afonsocosta Issue Monitored: afonsocosta
2014-01-14 14:22 c_schmitz Note Added: 27851
2014-01-14 14:22 c_schmitz Assigned To => c_schmitz
2014-01-14 14:22 c_schmitz Status new => feedback
2014-01-14 14:26 afonsocosta File Added: limesurvey_survey_388849.lss
2014-01-14 14:27 afonsocosta Note Added: 27853
2014-01-14 14:27 afonsocosta Status feedback => assigned
2014-01-14 14:28 DenisChenu File Added: Capture du 2014-01-14 14:16:32.png
2014-01-14 14:31 DenisChenu Note Added: 27854
2014-01-14 14:32 DenisChenu Note Edited: 27854
2014-01-14 14:39 c_schmitz Note Added: 27855
2014-01-14 14:39 afonsocosta File Added: problem.jpg
2014-01-14 14:39 afonsocosta Note Added: 27856
2014-01-14 14:40 c_schmitz Note Edited: 27855
2014-01-14 14:44 c_schmitz Assigned To c_schmitz => tpartner
2014-01-14 14:44 c_schmitz Note Added: 27857
2014-01-14 15:05 DenisChenu Note Added: 27858
2014-01-14 15:06 afonsocosta Note Added: 27859
2014-01-14 17:08 tpartner Note Added: 27861
2014-01-14 17:08 tpartner Assigned To tpartner =>
2014-01-14 17:08 tpartner Assigned To => c_schmitz
2014-01-14 17:09 tpartner Note Edited: 27861
2014-01-14 17:19 c_schmitz Assigned To c_schmitz => mdekker
2014-01-14 17:19 c_schmitz Note Added: 27863
2014-01-14 17:27 DenisChenu File Added: limesurvey_survey_2array.lss
2014-01-14 18:03 DenisChenu File Added: em_manager_helper.php
2014-01-14 18:04 DenisChenu File Deleted: em_manager_helper.php
2014-01-14 18:04 DenisChenu File Added: patch08538.diff
2014-01-14 18:04 DenisChenu Note Added: 27864
2014-01-14 21:25 c_schmitz Note Added: 27868
2014-01-14 21:29 c_schmitz Assigned To mdekker => DenisChenu
2014-01-15 09:13 mdekker Note Added: 27870
2014-01-15 09:55 afonsocosta Note Added: 27873
2014-01-15 10:00 DenisChenu Note Added: 27874
2014-01-15 10:01 DenisChenu Note Edited: 27874
2014-01-15 11:29 DenisChenu Changeset attached => LimeSurvey master 24d33028
2014-01-15 11:29 DenisChenu Note Added: 27877
2014-01-15 11:29 DenisChenu Resolution open => fixed
2014-01-15 11:29 DenisChenu Status assigned => resolved
2014-01-15 11:29 DenisChenu Fixed in Version => 2.05+
2014-01-16 16:45 c_schmitz Note Added: 27910
2014-01-16 16:45 c_schmitz Status resolved => closed
2021-08-03 17:56 guest Bug heat 10 => 12