View Issue Details

This bug affects 1 person(s).
 6
IDProjectCategoryView StatusLast Update
05859Bug reportsImport/Exportpublic2012-03-14 21:08
Reportermmirasol Assigned ToTMSWhite  
PrioritynormalSeverityminor 
Status closedResolutionfixed 
Product Version1.92RC5 
Fixed in Version1.92+ 
Summary05859: question group import does not update references properly
Description

I installed 1.92 RC5 on our test server and imported a completed survey created using Version 1.91+ Build 12416.

After doing an initial test execute, I observed that the conditions I set up on q3 (type: radiolist with comment) based on s2 (type: radiolist) no longer works. The question setup is as follows:

s2 (Yes/No)
q3 (Qualified/Not qualified), Qualified if s2=Yes, otherwise Not Qualified .

Even if I answer Yes for s2, q3 still shows up as Not Qualified so I put alert("{INSERTANS:(s2 sqga)}"); in q3 and it shows some html instead of the value of s2. please see attached file.

After reviewing the relevance rules, I observed that the references are still that of my old survey, they were not reconfigured properly as necessary.

I also observed that value returned by {INSERTANS:(sgqa)} is the question code in contrast to shown text in Version 1.91+ Build 12416. This renders my logic programming wrong.

Steps To Reproduce
  1. import survey.
  2. check relevance rules for questions q1,q2,q3.
  3. execute the survey.
TagsNo tags attached.
Attached Files
insertans-radio-list.JPG (12,675 bytes)   
insertans-radio-list.JPG (12,675 bytes)   
test2.zip (48,876 bytes)
Bug heat6
Complete LimeSurvey version number (& build)12022
I will donate to the project if issue is resolvedNo
Browser
Database type & versionmysql Ver 14.14 Distrib 5.1.49, for debian-linux-gnu (x86_64)
Server OS (if known)2.6.35-32-server GNU/Linux Ubuntu Server x86
Webserver software & version (if known)Apache/2.2.16 (Ubuntu)
PHP VersionPHP 5.3.3-1ubuntu9.10

Users monitoring this issue

There are no users monitoring this issue.

Activities

TMSWhite

TMSWhite

2012-02-28 02:01

reporter   ~17668

That file is already corrupted - the SGQA codes for the logic don't match the rest (so it is guaranteed to import wrong).

Can you please attach a file that does work, and we can test whether importing it leads to problems?

TMSWhite

TMSWhite

2012-02-28 02:22

reporter   ~17669

When I manually re-create the conditions, export the file, and re-import it, all of the conditions convert properly, including the hidden JavaScript in question q3. Just did this twice (exporting/re-importing) without any trouble.

There were some problems in older release candidates. Perhaps it was an issue there?

I'm attaching the converted survey. I may not have the conditional logic exactly the same, but you get the idea.

mmirasol

mmirasol

2012-02-28 03:47

reporter   ~17670

Hello Tom,

I just attached the original survey created in Version 1.91+ Build 12416 with its theme. I imported this in Version 1.92 RC5 Build 120225 and the relevance rules and conditions look ok after the import. I even imported the survey again and the relevance and conditions look ok too.

The issue is that q1 ("Congratulations...") does not appear even though it passes the conditions set. Importing the same survey and theme in Version 1.91+ Build 12416 works with no issues.

mmirasol

mmirasol

2012-02-28 03:50

reporter   ~17671

Last edited: 2012-02-28 03:50

Is it safe to assume that 1.92 should be backwards compatible and you should not have to redo conditions if you're importing a survey from an older version of lime?

TMSWhite

TMSWhite

2012-02-28 04:16

reporter   ~17672

Yes, 1.92 is backwards compatible with three small but unavoidable exceptions:
(1) Any custom embedded JavaScript must have spaces after opening curly braces and spaces before closing curly braces
(2) Such JavaScript using regular expressions containing curly braces within the JavaScript must use quotes around the regular expressions rather than the in-line JavaScript syntax like anSSN.match(/\d{3}-\d{2}-\d{4}/)
(3) Mathematical comparisons against empty - http://docs.limesurvey.org/Expression+Manager+Roadmap#Mathemematical_Comparisons_against_Empty_no_response_

The reason q1 doesn't work in 1.92 is because your regular expressions are not properly formed. The generated relevance equation for q1 is:

((s2.NAOK == "A1") and (regexMatch("[1-2][0-9]", s3.NAOK) or regexMatch("[2-9]", s3.NAOK) or s3.NAOK == "30") and (s4.NAOK >= "30"))

It should be:

((s2.NAOK == "A1") and (regexMatch("/[1-2][0-9]/", s3.NAOK) or regexMatch("/[2-9]/", s3.NAOK) or s3.NAOK == "30") and (s4.NAOK >= "30"))

When I fix the two regular expressions in the conditions editor, the Congratulations message appears as expected.

So, the fact that it works in 1.91 is actually a bug in 1.91. According the the documentation, regular expressions must always start and end with slashes - http://docs.limesurvey.org/Using+regular+expressions&structure=English+Instructions+for+LimeSurvey

TMSWhite

TMSWhite

2012-02-28 04:24

reporter   ~17673

I just tested limesurvey_survey_22321.lss with a recent 1.91+ stable release. It doesn't work there either, so if there was a bug in regular expression processing in 1.91, it has been fixed.

TMSWhite

TMSWhite

2012-02-28 04:32

reporter   ~17674

Since this is not a bug in 1.92, marking it as resolved.

mmirasol

mmirasol

2012-02-28 04:32

reporter   ~17675

thank you for this. i just learned something new again. =) so i assume that if the regular expressions had the slashes in the original survey, it would have worked as it should when it was imported in 1.92?

btw when you import questions / question groups with embedded INSERTANS is lime supposed to update those as well?

TMSWhite

TMSWhite

2012-02-28 04:35

reporter   ~17676

Yes, it would have worked with the slashes (I tested to confirm).

And yes, when importing, INSERTANS are supposed to be updated (but only if they point to a valid variable name to begin with). If you find any reproducible case where they are not being updated, please open a new bug ticket.

mmirasol

mmirasol

2012-02-28 13:25

reporter   ~17678

will do. =) thanks.

mmirasol

mmirasol

2012-03-07 03:49

reporter   ~17770

Hello Tom,

http://docs.limesurvey.org/tiki-index.php?page=Using+Regular+Expressions says:
SPECIAL NOTE: Regular Expressions in Conditions
Note that when using regular expressions in the condition editor, do NOT include the beginning and ending slash.

I just wanted to let you know that it seems that the conditions work with or without the slashes in Version 1.92 Build 120303. =)

TMSWhite

TMSWhite

2012-03-07 17:58

reporter   ~17781

Fixed with revision https://github.com/LimeSurvey/LimeSurvey/commit/f2f69355b18d887d3987f128d68aef9a6e88cca0

c_schmitz

c_schmitz

2012-03-11 16:31

administrator   ~17832

1.92+ Build 120211 released

Related Changesets

LimeSurvey: Yii c27de39d

2012-03-07 21:07:11

TMSWhite

Details Diff
Fixed issue 05859: question group import does not update references properly
Dev regular expressions entered into the conditions designer can be entered with or without surrounding slashes. EM will add the surrounding slashes if needed.
Affected Issues
05859
mod - application/helpers/expressions/em_manager_helper.php Diff File

Issue History

Date Modified Username Field Change
2012-02-28 00:50 mmirasol New Issue
2012-02-28 00:50 mmirasol File Added: limesurvey_survey_21126.lss
2012-02-28 00:51 mmirasol File Added: insertans-radio-list.JPG
2012-02-28 02:01 TMSWhite Note Added: 17668
2012-02-28 02:22 TMSWhite Note Added: 17669
2012-02-28 02:22 TMSWhite File Added: limesurvey_survey_13541.lss
2012-02-28 03:38 mmirasol File Added: limesurvey_survey_22321.lss
2012-02-28 03:38 mmirasol File Added: test2.zip
2012-02-28 03:47 mmirasol Note Added: 17670
2012-02-28 03:50 mmirasol Note Added: 17671
2012-02-28 03:50 mmirasol Note Edited: 17671
2012-02-28 04:16 TMSWhite Note Added: 17672
2012-02-28 04:24 TMSWhite Note Added: 17673
2012-02-28 04:32 TMSWhite Note Added: 17674
2012-02-28 04:32 TMSWhite Status new => resolved
2012-02-28 04:32 TMSWhite Resolution open => no change required
2012-02-28 04:32 TMSWhite Assigned To => TMSWhite
2012-02-28 04:32 mmirasol Note Added: 17675
2012-02-28 04:35 TMSWhite Note Added: 17676
2012-02-28 13:25 mmirasol Note Added: 17678
2012-03-04 23:21 c_schmitz Status resolved => closed
2012-03-07 03:49 mmirasol Note Added: 17770
2012-03-07 03:49 mmirasol Status closed => feedback
2012-03-07 03:49 mmirasol Resolution no change required => reopened
2012-03-07 17:58 TMSWhite Note Added: 17781
2012-03-07 17:58 TMSWhite Status feedback => resolved
2012-03-07 17:58 TMSWhite Fixed in Version => 1.92+
2012-03-07 17:58 TMSWhite Resolution reopened => fixed
2012-03-11 16:31 c_schmitz Note Added: 17832
2012-03-11 16:31 c_schmitz Status resolved => closed
2012-03-14 21:08 TMSWhite Changeset attached => Import 2012-03-09 13:30:34 Yii c27de39d