View Issue Details

This bug affects 1 person(s).
 6
IDProjectCategoryView StatusLast Update
06149Bug reportsExpression Managerpublic2012-06-07 11:02
ReporterMazi Assigned ToTMSWhite  
PrioritynormalSeverityminor 
Status closedResolutionfixed 
Product Version1.92+ 
Target Version1.92+Fixed in Version1.92+ 
Summary06149: EM shows wrong result for number generated by rand() function
Description

If I use an equation question type which generates a random number (1 or 2) if a previous question was answered X, then the generated number looks weird if the equation question is on the same page (see attached screenshot): 0.2648744165

If I switch the survey to question by question mode, the generated number is shown correctly as 1 or 2.
The number is also correctly shown when using the LimeReplacement fieldholder at a following question and it is stored correctly as 1/2, so this seems to only be a matter of display.

Steps To Reproduce
  1. Import the attached survey and activate it.
  2. Run it in group by group mode and answer the first question to create a random number.
  3. Check generated number on the same page, it looks weird.
  4. On the next page the boilerplate question shows the correct 1/2 value for the equation.
TagsNo tags attached.
Attached Files
rand_equation.png (7,165 bytes)   
rand_equation.png (7,165 bytes)   
Bug heat6
Complete LimeSurvey version number (& build)120530
I will donate to the project if issue is resolvedNo
BrowserFirefox 12
Database type & versionMySQL 5
Server OS (if known)Win 7
Webserver software & version (if known)Apache 2.2
PHP Version5.3.1

Users monitoring this issue

TMSWhite

Activities

TMSWhite

TMSWhite

2012-05-31 06:54

reporter   ~19011

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

TMSWhite

TMSWhite

2012-05-31 06:57

reporter   ~19012

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

c_schmitz

c_schmitz

2012-06-07 11:02

administrator   ~19105

New 1.91+ build released.

Related Changesets

LimeSurvey: master f8caaa18

2012-05-30 21:53:24

TMSWhite

Details Diff
Fixed issue 06149: EM shows wrong result for number generated by rand() function
Dev was using the JavaScript Math.random() function instead of the phpjs.org rand() function
Affected Issues
06149
mod - classes/expressions/ExpressionManager.php Diff File
mod - scripts/em_javascript.js Diff File

LimeSurvey: Yii 4ba0df1b

2012-05-30 21:56:38

TMSWhite

Details Diff
Fixed issue 06149: EM shows wrong result for number generated by rand() function
Dev was using the JavaScript Math.random() function instead of the phpjs.org rand() function
Affected Issues
06149
mod - application/helpers/expressions/em_core_helper.php Diff File
mod - scripts/expressions/em_javascript.js Diff File

Issue History

Date Modified Username Field Change
2012-05-30 10:44 Mazi New Issue
2012-05-30 10:44 Mazi Status new => assigned
2012-05-30 10:44 Mazi Assigned To => c_schmitz
2012-05-30 10:44 Mazi File Added: limesurvey_survey_95145-EM_rand_test.lss
2012-05-30 10:45 Mazi Issue Monitored: TMSWhite
2012-05-30 10:47 Mazi File Added: rand_equation.png
2012-05-31 06:54 TMSWhite Changeset attached => LimeSurvey master f8caaa18
2012-05-31 06:54 TMSWhite Note Added: 19011
2012-05-31 06:54 TMSWhite Assigned To c_schmitz => TMSWhite
2012-05-31 06:54 TMSWhite Resolution open => fixed
2012-05-31 06:57 TMSWhite Changeset attached => LimeSurvey Yii 4ba0df1b
2012-05-31 06:57 TMSWhite Note Added: 19012
2012-05-31 06:58 TMSWhite Status assigned => resolved
2012-05-31 06:58 TMSWhite Fixed in Version => 1.92+
2012-06-07 11:02 c_schmitz Note Added: 19105
2012-06-07 11:02 c_schmitz Status resolved => closed
2021-08-07 02:53 guest Bug heat 4 => 6