View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
10017 | Bug reports | Data Entry (non public) | public | 2015-11-04 09:54 | 2020-02-12 15:26 |
Reporter | sanderarons | Assigned To | ollehar | ||
Priority | urgent | Severity | partial_block | ||
Status | closed | Resolution | fixed | ||
Product Version | 2.06+ | ||||
Summary | 10017: Data from array is not saved correctly into the database (multiple rand() calls in EM/relevance equation) | ||||
Description | Limesurvey fails to save data from array questions. | ||||
Steps To Reproduce | 1 - welcome page with randomization question (1-3) | ||||
Additional Information | Please let me know what else you need to know and I will provide the info ASAP. My plan was to go live this week. However, after checking the data integrity and running some SPSS syntax I noticed the missing data. | ||||
Tags | No tags attached. | ||||
Attached Files | |||||
Bug heat | 12 | ||||
Complete LimeSurvey version number (& build) | Version 2.06+ Build 150629 | ||||
I will donate to the project if issue is resolved | Yes | ||||
Browser | Chrome | ||||
Database type & version | 5.5.32 - MySQL Community Server (GPL) | ||||
Server OS (if known) | UNIX | ||||
Webserver software & version (if known) | libmysql - mysqlnd 5.0.8-dev - 20102224 | ||||
PHP Version | 4.1.2 | ||||
Reminder sent to: c_schmitz, DenisChenu Hi, Is there any way to speed up this bug fix? I am waiting to go live with the survey and SSI (provides my respondents) is also waiting on me. However, if I go live with the current bug, about 2/3 of my data might be lost. Please let me know what my options are or what the expected timeline is. Kind regards, |
|
Multiple question with same code , maybe something here I can not reproduce after importing and data seems OK. |
|
I've attached a screenshot of the data as it appears in the database. Of the 19 times I have tested the survey, 11 times the data were not saved completely. Did you test it multiple times? I'll change the question names and try again with a new survey. I'll keep you posted. Thanks for the fast response today. |
|
Ok, so in order to rule out multiple questions with the same codes I have renamed them Q1-Q6. After testing this survey (see attached v2) the saving error is still there (see screenshot v2), this time with only 5 correctly saved responses of the 22 test runs I performed. I am at a loss here... Could you check if you can reproduce this error? Test it multiple times? Thanks |
|
I test 5 times with newtest=Y. Don't want to track down this one. |
|
So what other options are there? |
|
What PHP version is used? 4.1.2 is stated in the ticket. |
|
Yes, the phpMyAdmin version is 4.1.2. I'm not very much into IT so I hope this is the same as the PHP version you guys are referring to. If not, let me know where I can find the correct PHP version. |
|
Reminder sent to: c_schmitz Are there any other options that I can try? I am still hoping that someone can come up with a fix or explanation otherwise I will have to resort to other software and re-program the entire survey. |
|
How did you start the survey each time? What link did you use? |
|
I have used the Survey URL as can be found in the survey menu: In the database it says the ref URL is this: I have also tested it with: Same results, I still get missing data. |
|
Never newtest=Y or newtest/Y .... |
|
I just did 20 surveys with http://www.aronsconsultancy.nl/surveys/index.php/136935?newtest=Y&PID=XXX still 11 cases with missing data. |
|
So how can we fix this? |
|
I can reproduce this using report_error_arrays v2.lss |
|
I can reproduce this issue when I do nested conditions like in report_error_arrays v2. |
|
I think the error is that the relevance equation is evaluated more than once, so it's random if the two equations equal each other. Will try to confirm. You can set the seed of the rand function using srand, e.g. srand(1), in survey index class. For me, it then fails every time to save the response. |
|
Basically confirmed that this is the problem. If you disable re-validation in the JumpTo function, this error does not appear. Solution 1: Pre-process all expressions in the survey and replace rand with the number. This way, rand won't be called twice for one expression. BUT: Won't work, because where would we save the processed expressions so the survey won't read the original after reload? $_SESSION? |
|
When user are allowed to "com back" for setting alea, i use: This usage is really a specific usage , and sometimes : have {rand(1,10)} in equation question type are needed for some user (please : don't preprocess : this break some other system .....) See another example on manual: https://manual.limesurvey.org/Expression_Manager_Sample_Surveys#Randomly_Ask_One_Question_Per_Group With , in Equation : if(EQUA > 1 , EQUA,rand()) |
|
OK, I have a suggestion for a solution where the result of the rand expression is saved in a cache:
This is in em_core_helper.php, lines 2080 ff. What do you think? |
|
You mean random order ? This one is tricky : because:
It's the function createFieldMap https://github.com/LimeSurvey/LimeSurvey/blob/master/application/helpers/common_helper.php#L1784 , right ? I always think : first part must be in cache (and not in session) : https://bugs.limesurvey.org/view.php?id=7988 Randomization etc ... must be done in a plugin : https://github.com/LimeSurvey/LimeSurvey/blob/master/application/helpers/common_helper.php#L2338 Remind createFieldMap is used in admin and in public .... We have a lot of issue with randomization , with less system in survey .... Did the Expression system : [if(ALEA > 1,ALEA,rand(1,10)) work ? |
|
Fix committed to bug10017 branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=17040 |
|
I pushed my solution to a new branch, bug10017. To be tested and merged later, I guess. |
|
I already say :
But here : you add another function, just need manual update ;) Maybe unset $_SESSION['randResultCache']) must be in $SESSION['survey'.$iSurveyID] because some user can start (and it work) 2 different survey at a time. Denis |
|
@DenisChenu & @ollehar can i close this report ! Seems to be very old. Still the bug exists in LS4 ? Please create a new bug report for this for the new version. I will close this one ! |
|
LimeSurvey: bug10017 a2dc8abc 2016-02-02 10:57 Details Diff |
Fixed issue 10017: Make sure rand is only evaluated once each survey, using a cache for the function result |
Affected Issues 10017 |
|
mod - application/helpers/expressions/em_core_helper.php | Diff File | ||
mod - application/helpers/expressions/em_manager_helper.php | Diff File | ||
mod - application/helpers/frontend_helper.php | Diff File |
Date Modified | Username | Field | Change |
---|---|---|---|
2015-11-04 09:54 | sanderarons | New Issue | |
2015-11-04 09:54 | sanderarons | File Added: report_error_arrays.lss | |
2015-11-12 11:46 | sanderarons | Issue Monitored: c_schmitz | |
2015-11-12 11:46 | sanderarons | Issue Monitored: DenisChenu | |
2015-11-12 11:46 | sanderarons | Note Added: 33554 | |
2015-11-12 12:44 | DenisChenu | Note Added: 33555 | |
2015-11-12 12:45 | DenisChenu | Issue End Monitor: DenisChenu | |
2015-11-12 13:33 | sanderarons | File Added: data saving error.jpg | |
2015-11-12 13:38 | sanderarons | Note Added: 33556 | |
2015-11-12 13:46 | sanderarons | File Added: report_error_arrays v2.lss | |
2015-11-12 13:46 | sanderarons | File Added: data saving errorv2.jpg | |
2015-11-12 13:51 | sanderarons | Note Added: 33557 | |
2015-11-12 14:26 | sanderarons | Note Edited: 33557 | |
2015-11-12 14:40 | DenisChenu | Note Added: 33559 | |
2015-11-12 15:42 | sanderarons | Note Added: 33560 | |
2015-11-18 10:29 | jelo | Note Added: 33579 | |
2015-11-18 10:39 | sanderarons | Note Added: 33580 | |
2015-11-29 16:53 | sanderarons | Note Added: 33634 | |
2015-12-04 10:00 | c_schmitz | Note Added: 33668 | |
2015-12-04 10:01 | c_schmitz | Assigned To | => c_schmitz |
2015-12-04 10:01 | c_schmitz | Status | new => feedback |
2015-12-04 10:10 | sanderarons | Note Added: 33669 | |
2015-12-04 10:10 | sanderarons | Status | feedback => assigned |
2015-12-04 10:16 | DenisChenu | Note Added: 33671 | |
2015-12-04 10:24 | sanderarons | Note Added: 33672 | |
2015-12-08 09:46 | sanderarons | Note Added: 33727 | |
2016-02-01 10:54 | c_schmitz | Assigned To | c_schmitz => ollehar |
2016-02-01 10:59 | c_schmitz | Note Added: 34434 | |
2016-02-01 11:18 | c_schmitz | Note Edited: 34434 | |
2016-02-01 11:21 | c_schmitz | Note Edited: 34434 | |
2016-02-01 12:35 | ollehar | Note Added: 34438 | |
2016-02-01 14:30 | ollehar | Note Added: 34441 | |
2016-02-01 14:31 | ollehar | File Added: limesurvey_survey_945277.lss | |
2016-02-01 16:30 | ollehar | Note Added: 34444 | |
2016-02-01 16:49 | ollehar | Status | assigned => acknowledged |
2016-02-01 17:07 | DenisChenu | Note Added: 34447 | |
2016-02-01 17:10 | DenisChenu | Note Edited: 34447 | |
2016-02-01 18:03 | ollehar | Note Added: 34450 | |
2016-02-01 18:04 | ollehar | Note Edited: 34450 | |
2016-02-01 18:37 | DenisChenu | Note Added: 34451 | |
2016-02-02 10:58 | ollehar | Changeset attached | => LimeSurvey bug10017 a2dc8abc |
2016-02-02 10:58 | ollehar | Note Added: 34460 | |
2016-02-02 10:58 | ollehar | Resolution | open => fixed |
2016-02-02 11:02 | ollehar | Note Added: 34461 | |
2016-02-02 11:23 | DenisChenu | Note Added: 34462 | |
2016-02-04 17:11 | ollehar | Summary | Data from array is not saved correctly into the database => Data from array is not saved correctly into the database (multiple rand() calls in EM/relevance equation) |
2016-09-21 15:17 | c_schmitz | Issue End Monitor: c_schmitz | |
2019-09-23 12:18 | c_schmitz | Status | acknowledged => confirmed |
2020-02-12 15:25 | LimeBot | Note Added: 55919 | |
2020-02-12 15:26 | LimeBot | Note Edited: 55919 | |
2020-02-12 15:26 | LimeBot | Status | confirmed => closed |