View Issue Details

This bug affects 1 person(s).
 18
IDProjectCategoryView StatusLast Update
12452Bug reportsConditionspublic2017-10-09 13:45
Reportersickpig Assigned Toc_schmitz  
PrioritynoneSeveritypartial_block 
Status closedResolutionfixed 
Product Version2.64.x 
Fixed in Version2.65.x 
Summary12452: Conditional routing doesn't work, all vars are treated as string during comparison
Description

Hi

On LS 2.65.1+170522 the conditions based on integer variable (e.g Numerical Input) do not work anymore.

Steps To Reproduce

Create two question in 2 different group roup Q1 and Q2.

Q1: insert a number from 1 to +inf
Q2: A dummy question that has to be asked only of Q1 < 10

In Q1 insert 5

Click "Next"

Q2 group page will be displayed but the Q2 question is not displayed.

Additional Information

Attached a survey example you can import to verify the issue.

TagsNo tags attached.
Attached Files
Bug heat18
Complete LimeSurvey version number (& build)2.65.1+170522
I will donate to the project if issue is resolvedNo
Browserfirefox, chrome, edge, opera
Database type & versionpostgresql 9.5.7
Server OS (if known)Ubuntu Linux 16.04
Webserver software & version (if known)Apache 2.4.7
PHP Version5.5.9

Relationships

has duplicate 12456 closedc_schmitz Conditional routing doesn't work on scale and array questions 

Users monitoring this issue

DenisChenu

Activities

sickpig

sickpig

2017-06-01 16:26

reporter   ~43791

I've reproduced the problem also on an ubuntu 16.04 using mysql 5.7, apache 2.14.18 and php 7.0.18 using the attached survey

Deusdeorum

Deusdeorum

2017-06-05 10:54

reporter   ~43805

tested in "Version 2.59.1+170116" where it works as expected

sickpig

sickpig

2017-06-05 12:16

reporter   ~43806

git bisected the code. the commit that introduced the regression is:

9748fa9b5bcad5eafae4a24b7cb94ed61cbfb788 is the first bad commit
commit 9748fa9b5bcad5eafae4a24b7cb94ed61cbfb788
Author: Carsten Schmitz <carsten.schmitz@limesurvey.org>
Date: Tue Mar 7 13:45:17 2017 +0100

Fixed issue: Certain invalid numbers don't raise warning during entry                                                                                                

:040000 040000 8abec0b45927dd38202ac4b53327ad46135b59a7 e1a104f96276a05489ec956814f07c3df8b9e5ae M      scripts
c_schmitz

c_schmitz

2017-06-06 16:25

administrator   ~43824

The relevance equation set in the 2nd question in the sample survey reads Q1 < "10" so the behaviour is correct. It is a dictionary comparison in that case

It should read Q1<10 if you want a real numeric comparison.

DenisChenu

DenisChenu

2017-06-06 16:35

developer   ~43825

@c_schmitz : you rigfht, except "condition to exression" add the quote

sickpig

sickpig

2017-06-06 16:37

reporter   ~43827

But why LS is putting quote around 10 if this is a response given to a numerical input. ?
(the condition was defined via GUI.)

DenisChenu

DenisChenu

2017-06-06 16:41

developer   ~43828

@c_schmitz : line 960 of em_manager : can add a test:

if((string)floatval($value)!==(string) $value) {
$value = '"' . $value . '"';
}

Seems OK ?

c_schmitz

c_schmitz

2017-06-06 17:01

administrator   ~43829

Basically it is a bug in the Conditions to Relevance conversion that was uncovered now by my fix.
The right way would be to fix that one but it won't help with all the surveys that already use the wronlgy converted relevance.
So I will just water down my patch a bit again ;)

c_schmitz

c_schmitz

2017-06-06 17:01

administrator   ~43830

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

DenisChenu

DenisChenu

2017-06-06 17:16

developer   ~43831

https://github.com/LimeSurvey/LimeSurvey/commit/6320c3bb6340c088934f9fdbc8d0b2099681e37c ;).

But still : all old survey can have this issue :(

c_schmitz

c_schmitz

2017-06-06 17:36

administrator   ~43832

Thank you, Denis!

Version 2.65.2 released.

sickpig

sickpig

2017-06-06 20:09

reporter   ~43835

guys does this fix will take care of this regression: https://bugs.limesurvey.org/view.php?id=12456

markusfluer

markusfluer

2017-10-09 13:45

administrator   ~44553

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

Related Changesets

LimeSurvey: master 6ed9fad1

2017-06-06 16:55:34

c_schmitz

Details Diff
Fixed issue 12452: Numeric vars are treated as string during comparison Affected Issues
12452
mod - scripts/expressions/em_javascript.js Diff File

LimeSurvey: master e1122b15

2017-10-09 13:45:13

opinioni


Committer: markusfluer Details Diff
Fix issue 12452: Conditional routing doesn't work on scale and array questions (#783)

See https://bugs.limesurvey.org/view.php?id=12456 for more details
Affected Issues
12452
mod - scripts/expressions/em_javascript.js Diff File

Issue History

Date Modified Username Field Change
2017-06-01 15:26 sickpig New Issue
2017-06-01 15:26 sickpig File Added: limesurvey_survey_495226.lss
2017-06-01 16:26 sickpig Note Added: 43791
2017-06-05 10:17 DenisChenu Issue Monitored: DenisChenu
2017-06-05 10:54 Deusdeorum Note Added: 43805
2017-06-05 12:16 sickpig Note Added: 43806
2017-06-06 15:28 DenisChenu Relationship added related to 12456
2017-06-06 16:25 c_schmitz Note Added: 43824
2017-06-06 16:35 DenisChenu Note Added: 43825
2017-06-06 16:35 DenisChenu File Added: Capture du 2017-06-06 16-34-53.png
2017-06-06 16:35 DenisChenu Relationship replaced has duplicate 12456
2017-06-06 16:37 sickpig Note Added: 43827
2017-06-06 16:41 DenisChenu Note Added: 43828
2017-06-06 17:01 c_schmitz Note Added: 43829
2017-06-06 17:01 c_schmitz Changeset attached => LimeSurvey master 6ed9fad1
2017-06-06 17:01 c_schmitz Note Added: 43830
2017-06-06 17:01 c_schmitz Assigned To => c_schmitz
2017-06-06 17:01 c_schmitz Resolution open => fixed
2017-06-06 17:16 DenisChenu Note Added: 43831
2017-06-06 17:36 c_schmitz Status new => closed
2017-06-06 17:36 c_schmitz Fixed in Version => 2.65.x
2017-06-06 17:36 c_schmitz Note Added: 43832
2017-06-06 20:09 sickpig Note Added: 43835
2017-10-09 13:45 markusfluer Changeset attached => LimeSurvey master e1122b15
2017-10-09 13:45 markusfluer Note Added: 44553
2021-08-02 19:10 guest Bug heat 16 => 18