View Issue Details

This bug affects 1 person(s).
 8
IDProjectCategoryView StatusLast Update
13614Bug reportsSurvey takingpublic2018-11-21 16:35
Reportermferraz Assigned ToDenisChenu  
PrioritynoneSeveritypartial_block 
Status closedResolutionduplicate 
Fixed in Version3.15.x 
Summary13614: ranking questions aren't saved
Description

Hi

When we navigate in the survey, the ranking questions aren't saved.

I'm sending the export of the survey

TagsNo tags attached.
Attached Files
Bug heat8
Complete LimeSurvey version number (& build) 3.7.0+180418
I will donate to the project if issue is resolvedNo
Browser
Database type & versionMariadb 10.1.26-0+de
Server OS (if known)Debian 9.4
Webserver software & version (if known)Apache2 2.4.25-3+deb
PHP Version7.0.27-0+deb

Relationships

duplicate of 14162 closedDenisChenu Functionality of Drag and Drop in ranking questions breaks in dependance of relevance equations 

Users monitoring this issue

DenisChenu, duvemyster

Activities

DenisChenu

DenisChenu

2018-04-18 13:54

developer   ~47453

I can confirm the issue … dropdown are prefilled with good value … maybe JS broken when reload

Demetra

Demetra

2018-11-20 16:37

reporter   ~49713

I'm having the same problem on Version 3.15.5+181115, lss attached.

The question shows up properly, but when submitted it doesn't save any data on db.
In my case the question is filtered via "Array filter" on a previous multiple choice and has "Maximum columns for answers" setted.
Usually I don't set these kind of properties and never had problem with ranking before.

Enabling debug and db debug it seems to me that the form send right data but the update statement set every field to NULL

Demetra

Demetra

2018-11-21 16:14

reporter   ~49715

Hello, we worked a bit on it and we found that something wasn't working properly in _ValidateQuestion, in particular on question relevance assignement for ranking type questions (em_manager_helper.php:6285).
We think that in order to assign relevance you should evaluate answers when available (group save) and not only fieldnames.

We try to fix this, attached a possibile patch. We tested a bit and it seems to be working properly.

em_manager_helper.php.patch (2,609 bytes)   
--- original/limesurvey/application/helpers/expressions/em_manager_helper.php	2018-11-15 14:36:18.000000000 +0100
+++ fixed/limesurvey/application/helpers/expressions/em_manager_helper.php	2018-11-21 15:58:06.301022756 +0100
@@ -6271,6 +6270,9 @@
                 } else {
                     $sgqas = explode('|',$LEM->qid2code[$qid]);
                 }
+		if($qInfo['type']=='R') {
+                    $updatedValues=$LEM->ProcessCurrentResponses();
+		}
                 foreach ($sgqas as $sgqa) {
                     // for each subq, see if it is part of an array_filter or array_filter_exclude
                     if (!isset($LEM->subQrelInfo[$qid])) {
@@ -6279,22 +6281,20 @@
                     }
                     $foundSQrelevance=false;
                     if($qInfo['type']=='R') {
-                        // Relevance of subquestion for ranking question depend of the count of relevance of answers.
-                        $iCountRank=(isset($iCountRank) ? $iCountRank+1 : 1);
-                        // Relevant count is : Total answers less Unrelevant answers. subQrelInfo give only array with relevance equation, not this without any relevance.
-                        $iCountRelevant=isset($iCountRelevant) ? $iCountRelevant : count($sgqas)-count(array_filter($LEM->subQrelInfo[$qid],function($sqRankAnwsers){ return !$sqRankAnwsers['result']; }));
-                        if($iCountRank >  $iCountRelevant)
-                        {
+                        $firstsgqa = array_keys($LEM->subQrelInfo[$qid])[0];
+                        if(count($updatedValues) > 0){
+                            $sgqa_base = isset($sgqa_base) ? $sgqa_base : $LEM->subQrelInfo[$qid][$firstsgqa]['sgqa']; 
+                            $key = $sgqa_base . $updatedValues[$sgqa]['value'];
+                            if($updatedValues[$sgqa]['value'] && $LEM->subQrelInfo[$qid][$key]['result']){
+                                $relevantSQs[] = $sgqa;
+                            } else {
                             $irrelevantSQs[] = $sgqa;
                         }
-                        else
-                        {
+                        } else {
                             $relevantSQs[] = $sgqa;
                         }
-                        // This just remove the last ranking : don't control validity of answers done: user can rank irrelevant answers .... See Bug #09774
                         continue;
                     }
-
                     foreach ($LEM->subQrelInfo[$qid] as $sq)
                     {
                         switch ($sq['qtype'])
em_manager_helper.php.patch (2,609 bytes)   
DenisChenu

DenisChenu

2018-11-21 16:20

developer   ~49716

But why it work in 2.6lts and 2.73 ?

Maybe relevance is unrelated to current issue if exist : and must be report as a new bug ?

DenisChenu

DenisChenu

2018-11-21 16:25

developer   ~49717

3.15.2

DenisChenu

DenisChenu

2018-11-21 16:32

developer   ~49718

@Demetra : OK, your issue is unrelated to this one (and to other one) …
This one and the other : js issue. Your's even with JS deactivated : it broke AND 2.73 have same issue (2.6lts too)

Please : report it on another ticket :)

DenisChenu

DenisChenu

2018-11-21 16:35

developer   ~49719

And see issue https://bugs.limesurvey.org/view.php?id=9774

Issue History

Date Modified Username Field Change
2018-04-18 12:34 mferraz New Issue
2018-04-18 12:34 mferraz File Added: Screenshot-20180418103313-1377x383.png
2018-04-18 12:34 mferraz File Added: limesurvey_survey_177233.lss
2018-04-18 13:54 DenisChenu Status new => confirmed
2018-04-18 13:54 DenisChenu Note Added: 47453
2018-04-18 13:56 DenisChenu Assigned To => markusfluer
2018-04-18 13:56 DenisChenu Status confirmed => assigned
2018-04-27 17:43 duvemyster Issue Monitored: duvemyster
2018-11-20 16:37 Demetra File Added: limesurvey_survey_964591.lss
2018-11-20 16:37 Demetra Note Added: 49713
2018-11-21 10:21 DenisChenu Issue Monitored: DenisChenu
2018-11-21 16:14 Demetra File Added: em_manager_helper.php.patch
2018-11-21 16:14 Demetra Note Added: 49715
2018-11-21 16:20 DenisChenu Note Added: 49716
2018-11-21 16:25 DenisChenu Relationship added duplicate of 14162
2018-11-21 16:25 DenisChenu Assigned To markusfluer => DenisChenu
2018-11-21 16:25 DenisChenu Status assigned => closed
2018-11-21 16:25 DenisChenu Resolution open => duplicate
2018-11-21 16:25 DenisChenu Fixed in Version => 3.15.x
2018-11-21 16:25 DenisChenu Note Added: 49717
2018-11-21 16:32 DenisChenu Note Added: 49718
2018-11-21 16:35 DenisChenu Note Added: 49719
2021-08-03 01:52 guest Bug heat 4 => 8