Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

Plugin for changing or fixing question index behaviour

  • mareinoso
  • mareinoso's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
2 weeks 1 day ago #270065 by mareinoso
Please help us help you and fill where relevant:
Your LimeSurvey version: [url=http://localhost/lsinicia/evaluacion/index.php?r=surveyAdministration/view&iSurveyID=976812#modalSystemInformation]6.11.0+250303 [/url]
Own server or LimeSurvey hosting: Own server
Survey theme/template: Bootswatch / extended theme
==================
Hello everyone,

I'm having a problem with the survey index using token based response persistence and want to move a fix we have in the code to a plugin, as background info our surveys are group by group where each group has one question, we also use a full index that's always visible to the participants, so we experience a problem when the user does the following:
At question 30 they answer and then go back to question 10 and close the survey, after the participant re-enters there's no info on any index item after question 10 leaving them as unanswered, this behavior is seen in both the default template and our own.

Our fix for this goes directly in the source code and gets if the question is answered through a query and then builds the array caring only about if the question was answered or not, replacing the code in the file. Now I have been doing research on this problem and found the plugin fixMaxStep this plugin is quite old, and I'm not sure if it would work nowadays even if updated. From looking at the code from questionIndexHelper specifically getIndexItemsGroups:

The problem seems to happen in here, this array contains only the data until the view/question the user has visited/moved like with jumpTo()
   $stepInfos = LimeExpressionManager::GetStepIndexInfo();

For the plugin, I tried accessing aSurveyInfo and replace aQuestionIndex during beforeSurveyPage, but I couldn't do that. Another way I tried was piggybacking out of some data that goes to the template trying other hooks so I could append my array, and then add some logic in the twig using that array instead of the default one, but I couldn't find any accessible data from plugin to template, finally I have been checking ExpressionManagerStart that says it allows me to create a function and also can be accessed from the template using {{ processString("{getCompleteIndexItemsGroups('type')}") }} I have this inside the layout_global.twig and have no progress getting a simple debug response back from that call.

It would be immensely helpful if anyone has insight on this problem and how they overcame it, any recommendations on which one of those paths is viable is really appreciated.

Thanks,
Martín

Please Log in to join the conversation.

More
1 week 6 days ago #270074 by DChenu

At question 30 they answer and then go back to question 10 and close the survey, after the participant re-enters there's no info on any index item after question 10 leaving them as unanswered, this behavior is seen in both the default template and our own.

 
I'm not sure to understand, you mean the color of Group in index ?

Else the step saved in DB are the current step, my opinion : we must have (in certain case) current step AND maximal step .

Please Log in to join the conversation.

  • mareinoso
  • mareinoso's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 week 6 days ago #270081 by mareinoso
Yeah, it's about the color indicators of the index. When a user closes and later resumes the survey, the index only shows progress up to the last viewed group (e.g., group 10), even if they answered up to group 30, everything after group 10 appears with no CSS Class and ends up looking as if unanswered. It updates correctly again as they move forward, but only up to their current step.

We tried simulating a jump to the final group and back to refresh the index, which worked, but messed with survey timing data we need later, so we had to drop it.

Thanks for the plugin link, it looks like it does what we need, of loading the index up to the actual last page seen.

Please Log in to join the conversation.

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
1 week 5 days ago - 1 week 5 days ago #270088 by DenisChenu

Thanks for the plugin link, it looks like it does what we need, of loading the index up to the actual last page seen.


 
I think of a solution to create a feature and pull request for this issue.

For keepMaxStep solution with plugin : it's really a complex plugin for only this part … need to be rewrite to offer only this fix.
 

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
Last edit: 1 week 5 days ago by DenisChenu.

Please Log in to join the conversation.

  • mareinoso
  • mareinoso's Avatar Topic Author
  • Offline
  • New Member
  • New Member
More
1 week 4 days ago - 1 week 4 days ago #270108 by mareinoso
Thanks for that! I have another question, since we’re still exploring options and plugin capabilities. Is it possible to send an HTML element from the plugin to the participant's view? For example, the BeforeTwigRenderTemplate event mentions it can add HTML to the produced html, can that be used to inject custom elements into the survey page?Thanks again for the help, and let me know if it’s better to move these questions to a separate topic.
Last edit: 1 week 4 days ago by mareinoso.

Please Log in to join the conversation.

Moderators: holchtpartner

Lime-years ahead

Online-surveys for every purse and purpose