Welcome to the LimeSurvey Community Forum

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

Scoring based on remaining time in timer

More
6 days 11 hours ago #241531 by SimonPressler
Please help us help you and fill where relevant:
Your LimeSurvey version: 5.6.8
Own server or LimeSurvey hosting: LimeSurvey hosting
Survey theme/template: fruity
==================
Hey,
i would like to design a project in which respondents need to answer under a time constraint. The remainder of the time is their there score if they answer a question correctly.
Is this possible?
Thanks in advance

Please Log in to join the conversation.

More
6 days 9 hours ago - 6 days 9 hours ago #241534 by tpartner
The simplest method would be to record the timings in the data and generate the scores in post-survey analysis.

- manual.limesurvey.org/Notifications_%26_data/en#Save_Timings

If you need the scores dynamically in the survey, you can:

1) Add a short-text question to every scored question group.

2) Enable timers on the short-text questions.

3) Add this script to the source of each short-text question. It will hide the text input and update it with the remaining time (in seconds) every second.

Code:
<script type="text/javascript" data-author="Tony Partner">
 
  $(document).on('ready pjax:scriptcomplete',function(){
 
    // Identify this question
    var thisQuestion = $('#question{QID}');
 
    // Hide the text input
    //$('.answer-container .text-item', thisQuestion).hide();
 
    // A function to parse the timer time and load the text input
    function updateTime() {
      var aTimerTime = $.trim($('.ls-timer-time', thisQuestion).text()).split(':');
      var seconds = (Number(aTimerTime[0])*3600)+(Number(aTimerTime[1])*60)+Number(aTimerTime[2]);
      $(':text.form-control', thisQuestion).val(seconds).trigger('keyup');
    }
 
    setTimeout(function() {
      // Record the initial timer time
      updateTime();
 
      // Update the recorded time every second
      setInterval(updateTime, 1000);
    }, 50);
 
  });
</script>

Here is a sample survey in which I have left the text input visible for testing purposes:  

File Attachment:

File Name: limesurvey...2446.lss
File Size:44 KB

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
Last edit: 6 days 9 hours ago by tpartner.

Please Log in to join the conversation.

More
5 days 14 hours ago #241555 by SimonPressler
Thank you very much, this is already really helpful! Can i also make the score dependent on, the selected answer in a dropdown? I.e. the scoring value of one question times the remaining time?

Please Log in to join the conversation.

More
5 days 14 hours ago #241556 by tpartner
Yes, you would do that in an equation question using ExpressionScript.

- manual.limesurvey.org/ExpressionScript_-_Presentation/en

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

More
5 days 14 hours ago #241560 by SimonPressler
Thanks again, that should solve my problem!

Please Log in to join the conversation.

Lime-years ahead

Online-surveys for every purse and purpose