View Issue Details

This bug affects 1 person(s).
 8
IDProjectCategoryView StatusLast Update
16230Bug reportsExpression Managerpublic2022-02-14 11:23
ReporterDenisChenu Assigned ToDenisChenu  
PrioritynoneSeverityminor 
Status closedResolutionfixed 
Product Version4.2.2 
Summary16230: Reload survey (token answer persistence) don't really reload …
Description

When using Equation to set question (if empty) : https://manual.limesurvey.org/Expression_Manager#Using_Assignment_Operator
This work when we are inside survey, but when reload survey (with token answer persistence) : data is resetted

Steps To Reproduce

Import included survey,
Test a token link with newtest
Entre something other than 'prefilled'
Move next save
Quit browser
Open bronser and test again

See screencast

Additional Information

2.6lts and 3.22 have the same issue.

Then : muts not "fix" for 4, but must document it ?

TagsNo tags attached.
Attached Files
Peek 05-05-2020 17-05.gif (357,662 bytes)
Bug heat8
Complete LimeSurvey version number (& build)4.2.2 github
I will donate to the project if issue is resolvedNo
Browsernot relevant ?
Database type & versionnot relevant
Server OS (if known)not relevant
Webserver software & version (if known)not relevant
PHP Version7

Users monitoring this issue

There are no users monitoring this issue.

Activities

DenisChenu

DenisChenu

2020-06-29 13:21

developer   ~58540

Related to relevanceStatus : …

DenisChenu

DenisChenu

2021-06-23 08:52

developer   ~65002

Last edited: 2022-01-19 15:15

Partial fix (muts be improved)

Then maybe a better solution are :

  • create a maxpage column in database : have lastpage + maxpage
  • when reload : LimeExpressionManager::JumpTo($maxpage, false, false, true); + LimeExpressionManager::JumpTo($lastpage, false, false, true);
galads

galads

2021-07-08 12:13

reporter   ~65259

Last edited: 2022-01-19 15:15

@DenisChenu will you like to create a pull request with the partial fix? I will create a task for the better solution you have mentioned and it will be picked up at a later stage

DenisChenu

DenisChenu

2021-07-19 09:29

developer   ~65505

Last edited: 2022-01-19 15:15

By Partial fix : it's usage of the whole plugin … and clearly : this one is here for a lot of other things ;)

gabrieljenik

gabrieljenik

2021-09-20 15:05

manager   ~66528

Last edited: 2022-01-19 15:15

We have been reviewing this and trying to reproduce it.
We could :)

Here are some thoughts.

1) The response is completeley loaded from the database, that is, it is loaded with the data that had been previously completed.

2) When you advance to the first page (the one with the formula with the assignment) the expression is processed, which in this case is: DataSet = if (is_empty (DataSet.NAOK), 'prefilled', DataSet.NAOK)

DataSet.NAOK only returns the value it raised from the database if DataSet.relevanceStatus == true.

At that moment, relevanceStatus for DataSet is false, because that question has not been processed yet, so its relevanceStatus cannot be known.

When starting a survey and uploading the questions, it is very difficult to know the relevance status it had at the end of the previous upload since those are calculated on the fly. That makes .NAOK accessors to return always empty.

3) If the assignment is done on the same page it works, as relevanceStatus becomes true.

Suggested actions:

  • Generate new attribute ".raw" to use on EM. No dependance on relevance status.

  • If the assignment needs to use .NAOK (or similar), and that requires relevanceStatus to be already calculated, does the assignment really works for setting default values?

So far, I believe it does only if equation is set on the same page as in the question to be defaulted (and view mode is not question by question). So, either
a) I believe we should remove the "forward-assignment" part from the manual (set default value) or
b) Ammend the manual to reflect so.

DenisChenu

DenisChenu

2021-09-20 15:28

developer   ~66531

Last edited: 2022-01-19 15:15

a) I believe we should remove the "forward-assignment" part from the manual (set default value) or

? I really don't see how some existing survey can not work without …

Again : We already have a lot of issue with maxtstep !== real max step

Why not

  • create a maxpage column in database : have lastpage + maxpage
  • when reload : LimeExpressionManager::JumpTo($maxpage, false, false, true); + LimeExpressionManager::JumpTo($lastpage, false, false, true);
gabrieljenik

gabrieljenik

2021-09-20 23:50

manager   ~66547

Last edited: 2022-01-19 15:15

Why not

  • create a maxpage column in database : have lastpage + maxpage
  • when reload : LimeExpressionManager::JumpTo($maxpage, false, false, true); + LimeExpressionManager::JumpTo($lastpage, false, false, true);

I feel more comfortable adding .raw then updating the rendering process.
Still, I understand your point.

Just thkinking outloud, wouldn't it be just enough with:
LimeExpressionManager::JumpTo($lastpage, false, false, true); two times?
First one will be usefull for setting relevance.
Second one will be usefull for overwritting any values miss set on first pass.

DenisChenu

DenisChenu

2021-09-21 08:30

developer   ~66549

Last edited: 2022-01-19 15:15

LimeExpressionManager::JumpTo($lastpage, false, false, true); two times?

No the point is : when reloading you are never sure lastpage in response table are the max page.

Then you need to save :

  • lastpage : the current page seen
  • maxpage : the max page seen

And you need to move to the maxpage before move to lastpage

See :

  1. https://gitlab.com/SondagesPro/coreAndTools/reloadAnyResponse/-/blob/master/reloadResponse.php#L69-75
  2. https://gitlab.com/SondagesPro/coreAndTools/reloadAnyResponse/-/blob/master/reloadResponse.php#L164-167

It's really used like this and it work.
I try to use a response DB column : but it break

I stop here : i already have the solution, i already answer multiple time on the how to fix the issue.
If someone have this issue : he can contact me for an offer. I'm really tired on the way it work now.

gabrieljenik

gabrieljenik

2021-09-21 14:38

manager   ~66572

Last edited: 2022-01-19 15:15

And you need to move to the maxpage before move to lastpage
You are right.

Still, that's like a great update.

ping @c_schmitz @ollehar for comments.

DenisChenu

DenisChenu

2021-10-06 08:12

developer   ~66761

Last edited: 2022-01-19 15:15

Want to discuss on zoho but https://projects.limesurvey.org/portal/limesurvey#taskdetail/85781000000271009/85781000001007039/85781000001035097 seems deleted.

galads

galads

2021-10-06 11:50

reporter   ~66765

Last edited: 2022-01-19 15:15

@DenisChenu it is not deleted. I added you to task owner and you should be able to comment now.

DenisChenu

DenisChenu

2021-10-06 12:03

developer   ~66768

Last edited: 2022-01-19 15:15

OK thanks :)
Seems zoho don't show the good error … … a 403 is really better.

DenisChenu

DenisChenu

2022-01-05 18:11

developer   ~67930

Last edited: 2022-01-19 15:15

I split this one in 2 part : one without updating DB

Fixing if user don't use previous , using lastpage only for master. Fix can be apply if OK in 3.X

Fixing if user use previous : adding an survey attribute and coiluln to keep current step (lastpage) and max step (maxpage)

DenisChenu

DenisChenu

2022-01-05 19:07

developer   ~67931

Last edited: 2022-01-19 15:15

Sh! i made an error …
Solution didn't work

set relevanceStatus to true by default work …
https://github.com/LimeSurvey/LimeSurvey/blob/16d809ea6cddb2fb14f9fbec3da12e17cf513569/application/helpers/expressions/em_manager_helper.php#L8771

DenisChenu

DenisChenu

2022-01-06 08:09

developer   ~67932

Last edited: 2022-01-19 15:15

@gabrieljenik : sorry, you're right … the only way is to fix the relevanceStatus point on a way or another …

Some idea :

  1. set relevanceStatus to 1 by default
  2. set relevanceStatus to 1 by default ONLY when come from NAOK or valueNAOK (or all)
  3. add a new suffix (rawNAOK ?)
  4. set the relevanceStatus of all questions before maxstep before do the jumpTo

2 can be great in my opinion ?
4 can be intereseting

When this is fixed : i fix the maxPage in develop version.

PS : for 2 : update the search here : https://github.com/LimeSurvey/LimeSurvey/blob/16d809ea6cddb2fb14f9fbec3da12e17cf513569/application/helpers/expressions/em_manager_helper.php#L8572-L8576

gabrieljenik

gabrieljenik

2022-01-06 16:19

manager   ~67933

Last edited: 2022-01-19 15:15

I need to get contexto into this again.
Feels like a big change, specially as is on the EM side.

@ollehar, what do you think?

DenisChenu

DenisChenu

2022-01-06 16:23

developer   ~67934

Last edited: 2022-01-19 15:15

Maybe add defaultRelevanceStaus as a public variable too ? Then we can set it when JumpTo after reloading.

I really like to have a clean way to fix it … really allow usage of "Using Assignment Operator" https://manual.limesurvey.org/Expression_Manager#Using_Assignment_Operator

A lot of forum helper (Jelo, holch …) give this advice : {QCODE=if(is_empty(QCODE.NAOK),"Value",QCODE.NAOK)} on forum …

gabrieljenik

gabrieljenik

2022-01-06 16:29

manager   ~67935

Last edited: 2022-01-19 15:15

I still need to get context.
Still, I am more inclined into adding new functionality as to no brake anything that is already working.

DenisChenu

DenisChenu

2022-01-11 08:10

developer   ~67947

Last edited: 2022-01-19 15:15

After a lot of thinking : I really think we need to set relevanceStatus of all variables before the current step

But relevanceStatus is set on ProcessAllNeededRelevance https://github.com/LimeSurvey/LimeSurvey/blob/538e0706f17938b31631c4b76874020323da7afd/application/helpers/expressions/em_manager_helper.php#L4102

But this function

  1. return if $gseq != $this->currentGroupSeq
  2. Seem not called when JumpTo with $force
DenisChenu

DenisChenu

2022-01-11 08:11

developer   ~67948

Last edited: 2022-01-19 15:15

Go to each group and https://github.com/LimeSurvey/LimeSurvey/blob/538e0706f17938b31631c4b76874020323da7afd/application/helpers/expressions/em_manager_helper.php#L6743 StartProcessingGroup ?

In a static function ReloadSurvey ?

DenisChenu

DenisChenu

2022-01-14 19:34

developer   ~68029

Last edited: 2022-01-19 15:15

@galads : not done ,but set as done in project : https://projects.limesurvey.org/portal/limesurvey#taskdetail/85781000001335039/85781000001337011/85781000001035097

DenisChenu

DenisChenu

2022-01-19 15:15

developer   ~68050

Last edited: 2022-01-19 15:15

https://github.com/LimeSurvey/LimeSurvey/pull/2211

DenisChenu

DenisChenu

2022-02-10 12:59

developer   ~68263

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

LimeBot

LimeBot

2022-02-14 11:23

administrator   ~68291

Fixed in Release 5.2.14+220214

Related Changesets

LimeSurvey: master dbe2055f

2022-02-10 12:59:07

DenisChenu


Committer: GitHub Details Diff
Fixed issue 16230: Reload survey (token answer persistence) don't really reload (#2211)

* Fixed issue 16230: Reload survey (token answer persistence) don't really reload …
Dev: LEMtokenResume with reload by token too
Dev: set maxstep to totalstep if needed
Dev: Create LimeExpressionManager::SetRelevanceTo to set relevance before JumpTo in case of reload
Dev: When reload : initFirstStep function before all other: then move reloading part here.

* Dev: remove some dev test …
Affected Issues
16230
mod - application/helpers/SurveyRuntimeHelper.php Diff File
mod - application/helpers/expressions/em_manager_helper.php Diff File
mod - application/helpers/frontend_helper.php Diff File

Issue History

Date Modified Username Field Change
2020-05-05 17:06 DenisChenu New Issue
2020-05-05 17:06 DenisChenu File Added: survey_archive_reloadAndSetIfEmpty.lsa
2020-05-05 17:06 DenisChenu File Added: Peek 05-05-2020 17-05.gif
2020-06-29 13:21 DenisChenu Note Added: 58540
2021-06-23 08:52 DenisChenu Note Added: 65002
2021-07-05 10:29 galads Assigned To => galads
2021-07-05 10:29 galads Status new => ready for testing
2021-07-08 12:13 galads Note Added: 65259
2021-07-08 12:14 galads Assigned To galads => DenisChenu
2021-07-08 12:14 galads Status ready for testing => assigned
2021-07-08 12:18 galads Sync to Zoho Project => |Yes|
2021-07-19 08:59 galads Assigned To DenisChenu => galads
2021-07-19 08:59 galads Status assigned => confirmed
2021-07-19 09:29 DenisChenu Note Added: 65505
2021-09-10 09:08 galads Assigned To galads => gabrieljenik
2021-09-10 09:08 galads Status confirmed => assigned
2021-09-20 15:05 gabrieljenik Note Added: 66528
2021-09-20 15:05 gabrieljenik Bug heat 4 => 6
2021-09-20 15:28 DenisChenu Note Added: 66531
2021-09-20 23:50 gabrieljenik Note Added: 66547
2021-09-20 23:51 gabrieljenik Note Edited: 66547
2021-09-21 08:30 DenisChenu Note Added: 66549
2021-09-21 14:38 gabrieljenik Note Added: 66572
2021-09-27 08:45 c_schmitz Zoho Project Synchronization Yes => |Yes|
2021-09-27 08:45 c_schmitz Assigned To gabrieljenik => DenisChenu
2021-10-06 08:12 DenisChenu Note Added: 66761
2021-10-06 11:50 galads Note Added: 66765
2021-10-06 12:03 DenisChenu Note Added: 66768
2021-10-19 08:20 c_schmitz Zoho Project Synchronization Yes => |Yes|
2022-01-05 18:11 DenisChenu Note Added: 67930
2022-01-05 19:07 DenisChenu Note Added: 67931
2022-01-06 08:09 DenisChenu Note Added: 67932
2022-01-06 08:10 DenisChenu Note Edited: 67932
2022-01-06 08:11 DenisChenu Note Edited: 67932
2022-01-06 16:19 gabrieljenik Note Added: 67933
2022-01-06 16:23 DenisChenu Note Added: 67934
2022-01-06 16:29 gabrieljenik Note Added: 67935
2022-01-11 08:10 DenisChenu Note Added: 67947
2022-01-11 08:11 DenisChenu Note Added: 67948
2022-01-14 19:34 DenisChenu Note Added: 68029
2022-01-19 15:15 DenisChenu Assigned To DenisChenu => galads
2022-01-19 15:15 DenisChenu Status assigned => ready for testing
2022-01-19 15:15 DenisChenu Note Added: 68050
2022-02-10 12:59 DenisChenu Changeset attached => LimeSurvey master dbe2055f
2022-02-10 12:59 DenisChenu Note Added: 68263
2022-02-10 12:59 DenisChenu Assigned To galads => DenisChenu
2022-02-10 12:59 DenisChenu Resolution open => fixed
2022-02-14 11:23 LimeBot Zoho Project Synchronization Yes => |Yes|
2022-02-14 11:23 LimeBot Note Added: 68291
2022-02-14 11:23 LimeBot Status ready for testing => closed
2022-02-14 11:23 LimeBot Bug heat 6 => 8