Relationship Graph

Relationship Graph
related to related to child of child of duplicate of duplicate of

View Issue Details

This bug affects 1 person(s).
 8
IDProjectCategoryView StatusLast Update
07763Bug reportsOtherpublic2013-05-14 14:38
Reporterdigmxl Assigned ToDenisChenu  
PrioritylowSeverityminor 
Status closedResolutionfixed 
Product Version2.00+ 
Target Version2.00+Fixed in Version2.00+ 
Summary07763: Answers not saved in database
DescriptionFirst set of questions (Q280a,Q290a, ... Q380a) are never saved in database
TagsNo tags attached.
Bug heat8
Complete LimeSurvey version number (& build)130406
I will donate to the project if issue is resolvedNo
Browser
Database type & versionmysql 5.5
Server OS (if known)linux
Webserver software & version (if known)apache2
PHP Versionphp5

Relationships

parent of 07805 closedDenisChenu Comparaison String and Numeric is different in same page and other page 

Activities

digmxl

digmxl

2013-04-12 21:45

reporter   ~24955

Last edited: 2013-04-12 21:48

View 2 revisions

limesurvey_group_357.lsg : group of questions causing the issue

digmxl

digmxl

2013-04-15 12:16

reporter  

survey.jpg (103,965 bytes)
digmxl

digmxl

2013-04-15 12:17

reporter  

pma.jpg (96,945 bytes)   
pma.jpg (96,945 bytes)   
c_schmitz

c_schmitz

2013-04-15 17:33

administrator   ~24957

The attached survey is way too big. Please try to reduce the survey to the smallest size possible where the issue is still reproducable.
digmxl

digmxl

2013-04-15 17:41

reporter  

digmxl

digmxl

2013-04-15 17:42

reporter   ~24958

limesurvey_survey_256293.lss : added smallest one
c_schmitz

c_schmitz

2013-04-22 14:37

administrator   ~25039

This is partially a problem in your survey. The result of a numerical question is a number. So you need to compare for one. Currently you are comparing for a string:

((( ! is_empty(Q280a.NAOK) && (Q280a.NAOK < "1995"))))

should be ((( ! is_empty(Q280a.NAOK) && (Q280a.NAOK < 1995))))

instead.
Yes, it is inconvenient, yes it is irritating that the in-page script still 'shows' the question - that is because JS and PHP behave slightly different when comparing strings and numbers.

Denis, do you see a way to 'unify' the behaviour in PHP and JS?
DenisChenu

DenisChenu

2013-04-22 15:07

developer   ~25045

I try to have a look, but not sure to find a goos solution for every problem.

Here :
Same think for " QCODE < number " AND " QCODE < "number" "in PHP and js ?

Choose js solution or php solution ?

Denis
c_schmitz

c_schmitz

2013-04-24 01:24

administrator   ~25101

I think the PHP solution would be the better one.
DenisChenu

DenisChenu

2013-04-24 10:06

developer   ~25104

OK,

But:
<q>If you compare a number with a string or the comparison involves numerical strings, then each string is converted to a number and the comparison performed numerically.</q> (http://php.net/manual/en/language.operators.comparison.php)

Then think EM make something like ISSTRING/ISNUMBER somewhere. Review this.
digmxl

digmxl

2013-04-24 12:06

reporter   ~25114

Hi,
The page is just 'showing' fine. The in-page script works fine too. The (Q280a.NAOK < "1995") works fine.
Q280a, Q290a, Q291a, Q300a, Q310a are NEVER saved in database quoting the year 1995 or not.
Im not sure the bug is somewhere in the view.
If i duplicate this group of questions in a new survey, same issue. No answers saved.
If i create the same group of questions from nothing, with same EM, it works, answers are properly saved.
There is something else.
DenisChenu

DenisChenu

2013-04-29 12:16

developer   ~25156

Hello,

It's not a comparaison problem.

When you use condition GUI, you use answer code and not answer text.

For your problem:
Q270.NAOK is A1 or A2 or A3 etc ...

You need to update answer code or use Q270.shown

.....

But still a minor issue with
"A1" > "1" for javascript somewhere.
DenisChenu

DenisChenu

2013-04-29 12:32

developer   ~25157

Here the problem is:

With javascript do
"A1">"1" : true
BUT
"A1" > 1 : false

Think the equation is bad:
Need to be more understable:

See ANSWERCODE ( Answer text) and not Answer text
DenisChenu

DenisChenu

2013-04-29 12:44

developer   ~25158

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

DenisChenu

2013-04-29 12:52

developer   ~25159

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

DenisChenu

2013-04-29 12:53

developer   ~25160

Fix condition GUI editor: more clean.

Fix for js/php comparaison can break a lot of survey (look at isnum function at EM core ...)
c_schmitz

c_schmitz

2013-04-29 15:15

administrator   ~25161

If it can break alot of surveys we should do it for 2.05 only, not for 2.0
DenisChenu

DenisChenu

2013-04-29 15:17

developer   ~25162

Maybe, but there are a lot of function for stroing to number in PHP if you look at em core.

Here : the code is bad.
DenisChenu

DenisChenu

2013-04-29 15:29

developer   ~25163

Last edited: 2013-04-29 16:19

View 2 revisions

em_core_helper.php:

Line 277:
$bMismatchType = (!$bBothNumeric && !$bBothString);

Some line after:
if ($bMismatchType) { $result = array(false,$token[1],'NUMBER'); }

Maybe have a :
$bBothString = ($bStringArg1 || $bStringArg2);

But what for "A1">1 : it's false in PHP ? But in JS ?

Denis

New bug : http://bugs.limesurvey.org/view.php?id=7805 but need discussion.

digmxl

digmxl

2013-05-07 11:57

reporter   ~25188

Thank you for your answers, your time and your support !
c_schmitz

c_schmitz

2013-05-14 14:38

administrator   ~25258

Version 2.0 Build 130514 released

Related Changesets

LimeSurvey: master b0515e62

2013-04-29 10:43:13

DenisChenu

Details Diff
Fixed issue 07763: Better information display in condition editor gui
Dev: condition editor GUI use code and not answer, then show code
Dev: Leave a problem with number/string comparaison : really don't know how to fix it
Affected Issues
07763
mod - scripts/jquery/lime-conditions-tabs.js Diff File

LimeSurvey: 2.05 5607b619

2013-04-29 10:50:50

DenisChenu

Details Diff
Fixed issue 07763: Better information display in condition editor gui
Dev: condition editor GUI use code and not answer, then show code
Dev: Leave a problem with number/string comparaison : really don't know how to fix it
Dev: strangly Answers array are Answer array in 205
Affected Issues
07763
mod - application/controllers/admin/conditionsaction.php Diff File
mod - scripts/admin/conditions.js Diff File

Issue History

Date Modified Username Field Change
2013-04-12 14:57 digmxl New Issue
2013-04-12 14:57 digmxl File Added: limesurvey_survey_525791.lss
2013-04-12 16:47 mfaber Issue Monitored: mfaber
2013-04-12 21:45 digmxl File Added: limesurvey_group_357.lsg
2013-04-12 21:45 digmxl Note Added: 24955
2013-04-12 21:48 digmxl Note Edited: 24955 View Revisions
2013-04-15 12:16 digmxl File Added: survey.jpg
2013-04-15 12:17 digmxl File Added: pma.jpg
2013-04-15 17:33 c_schmitz Note Added: 24957
2013-04-15 17:33 c_schmitz Assigned To => c_schmitz
2013-04-15 17:33 c_schmitz Status new => feedback
2013-04-15 17:41 digmxl File Added: limesurvey_survey_256293.lss
2013-04-15 17:42 digmxl Note Added: 24958
2013-04-15 17:42 digmxl Status feedback => assigned
2013-04-22 14:22 c_schmitz File Deleted: limesurvey_survey_525791.lss
2013-04-22 14:22 c_schmitz File Deleted: limesurvey_group_357.lsg
2013-04-22 14:34 c_schmitz Assigned To c_schmitz => DenisChenu
2013-04-22 14:37 c_schmitz Note Added: 25039
2013-04-22 15:07 DenisChenu Note Added: 25045
2013-04-24 01:24 c_schmitz Note Added: 25101
2013-04-24 10:06 DenisChenu Note Added: 25104
2013-04-24 12:06 digmxl Note Added: 25114
2013-04-29 12:16 DenisChenu Note Added: 25156
2013-04-29 12:32 DenisChenu Note Added: 25157
2013-04-29 12:44 DenisChenu Changeset attached => LimeSurvey master b0515e62
2013-04-29 12:44 DenisChenu Note Added: 25158
2013-04-29 12:44 DenisChenu Resolution open => fixed
2013-04-29 12:52 DenisChenu Changeset attached => LimeSurvey 2.05 5607b619
2013-04-29 12:52 DenisChenu Note Added: 25159
2013-04-29 12:53 DenisChenu Note Added: 25160
2013-04-29 12:53 DenisChenu Status assigned => resolved
2013-04-29 12:54 DenisChenu Severity partial_block => minor
2013-04-29 12:54 DenisChenu Fixed in Version => 2.00+
2013-04-29 12:54 DenisChenu Target Version => 2.00+
2013-04-29 15:04 DenisChenu Priority high => low
2013-04-29 15:15 c_schmitz Note Added: 25161
2013-04-29 15:17 DenisChenu Note Added: 25162
2013-04-29 15:29 DenisChenu Note Added: 25163
2013-04-29 16:12 DenisChenu Relationship added parent of 07805
2013-04-29 16:19 DenisChenu Note Edited: 25163 View Revisions
2013-05-07 11:57 digmxl Note Added: 25188
2013-05-14 14:38 c_schmitz Note Added: 25258
2013-05-14 14:38 c_schmitz Status resolved => closed