Dependency Graph

Dependency Graph
related to related to child of child of duplicate of duplicate of

View Issue Details

This bug affects 1 person(s).
 10
IDProjectCategoryView StatusLast Update
16634Bug reportsOtherpublic2020-10-05 08:36
ReporterMeirOverferst Assigned Togabrieljenik  
PrioritynormalSeverityminor 
Status closedResolutionfixed 
Product Version3.23.1 
Summary16634: Timer not getting reset after completion of the survey (running multiple surveys on the same browser)
Description

Timer not working when survey is active (when executing the survey multiple times in the same browser/tab)

Steps To Reproduce

Please import the survey and check it

TagsNo tags attached.
Attached Files
Bug heat10
Complete LimeSurvey version number (& build)irrelevant
I will donate to the project if issue is resolvedNo
Browser
Database type & versionirrelevant
Server OS (if known)
Webserver software & version (if known)
PHP Versionirrelevant

Relationships

related to 16635 closedgabrieljenik Timer not working when survey is active (when executing the survey multiple times in the same browser/tab) 

Activities

cdorin

cdorin

2020-09-02 18:00

reporter   ~59684

to be tested with all question types that use timer.

It affects users that use LS in kiosk mode

gabrieljenik

gabrieljenik

2020-09-02 21:38

manager   ~59694

Last edited: 2020-09-03 21:03

This is by design of the timer.
Timer uses cookies.
Actually, we shouldn't allow same surey on mutiple tabs. It should make a conflict in the session.

gabrieljenik

gabrieljenik

2020-09-03 21:05

manager   ~59699

It was not same survye in multiple tabs.
It was same survey running agani and again on the same browser (kiosk mode).
In that case, the timers are not reset,

Approach: When user hits submit, we will reset the individual timers for all the questions.
This should also be set when the quotas are exceded or upon termination.

@DenisChenu, @ollehar, what do you think?

DenisChenu

DenisChenu

2020-09-04 09:26

developer   ~59706

This is by design of the timer.

+1, and since years and years …
I see only one usage , and it's needed for this usage …

If need a different solution : please, need option at minima , or better (in my opinion) : a plugin

It affects users that use LS in kiosk mode

There are no reason to use timer in question in kiosk mode.

In kiosk mode you need a restart syesyem. Easy to do in theme, or in plugin

See javascript sample : https://gitlab.com/SondagesPro/coreAndTools/autoSaveAndQuit/-/blob/master/assets/autoSaveTimeAlert.js

cdorin

cdorin

2020-09-04 12:57

reporter   ~59707

I see the reasoning, but as a simple user, I would expect (I guess) the timer to gets reset every time someone submits a response

DenisChenu

DenisChenu

2020-09-04 13:02

developer   ~59708

Then : need another settings.

Why admin add timer ? => To limit time to the user
Why need limiting time to user ? => Sample : disallow usage of dictionnary or web to find answers .

If you reset each time it's loaded : easy to broke this.

Don't think to final user : think to admin user.

gabrieljenik

gabrieljenik

2020-09-04 17:54

manager   ~59710

Last edited: 2020-09-05 04:17

If you reset each time it's loaded : easy to broke this.

I want to reset when submitting of the whole survey, not when starting.
When starting a fresh new response, it would be good to reset it also.

DenisChenu

DenisChenu

2020-09-04 17:57

developer   ~59711

Last edited: 2020-09-04 17:58

When starting a fresh new response, it would be good to reset it also.

It's what i mean, the only situation where i see it used it's needed even * with newtest=Y

  • To not reset it, but keep question unanswered.
ollehar

ollehar

2020-09-07 15:42

administrator   ~59724

New setting: Kiosk mode?

DenisChenu

DenisChenu

2020-09-07 15:51

developer   ~59725

If you mlean kiosk mode : restar the survey after XXX minutes : it's just a javascript snippet …

You really need a global Survey settings : DB update etc …

Easiest solution : plugin .

ollehar

ollehar

2020-09-07 15:52

administrator   ~59726

It depends on how common this use-case is.

gabrieljenik

gabrieljenik

2020-09-08 01:18

manager   ~59728

@DenisChenu Can you explain again this:
https://bugs.limesurvey.org/view.php?id=16634#c59711

Sorry, I don't undestand.
You DO think it is ok to reset when newtest=Y or you DON'T think it is a good idea?

DenisChenu

DenisChenu

2020-09-08 08:25

developer   ~59732

we MUST NOT reset when newtest=Y or survey session is empty.

Because it work like this since 1.80 (and maybe before). If we update this : we broke previous usage .

ollehar

ollehar

2020-09-08 10:30

administrator   ~59733

I thought newtest=Y reset everything?

DenisChenu

DenisChenu

2020-09-08 10:36

developer   ~59734

Fuck lost all data !

DenisChenu

DenisChenu

2020-09-08 10:42

developer   ~59735

Last edited: 2020-09-08 10:43

Do it again …

I thought newtest=Y reset everything?

it's false , it reset the survey session (and not other things (must not))

Else : i already propose to move this timer script to a plugins (see)

  1. Seems not used a lot
  2. It's buggy with Expression Validation or mandatory
  3. It was done only in HTML and JS (easiest to move in plugin)
  4. It take a lot of place in settings
  5. Not included in Expression Manager (see 2 and easiest)
  6. No PHP control : easy to break
  7. It can be easiest adapted (without update LimeSurvey API) if it's in plugin
  8. It can be easiest improved if is lighter

See
https://bugs.limesurvey.org/view.php?id=6660
https://bugs.limesurvey.org/view.php?id=8750

ollehar

ollehar

2020-09-08 10:45

administrator   ~59736

Fuck lost all data !

?

DenisChenu

DenisChenu

2020-09-08 10:48

developer   ~59737

See screenshot : i put data in Time tracking : i report on another mantis.

related :
https://bugs.limesurvey.org/view.php?id=15403

ollehar

ollehar

2020-09-08 10:49

administrator   ~59738

Alright.

gabrieljenik

gabrieljenik

2020-09-10 17:48

manager   ~59771

With newtest=Y parameter, the timer should get reset no matter what I know it s like that since 1.8, but it is a bug Got the ok from Carsten

cdorin

cdorin

2020-09-10 17:50

reporter   ~59772

The issue is a bug. I know that many workarounds have been found already, but for a simple user the workarounds are not simple solutions. And the new session start makes total sense to restart the timer. The big problem we have now (and to think of a solution in the future): how to inform everyone about such changes. Wrote it down and see when there will be resources for some kind of LimeSurvey notification sidebar in homepage (or anything similar)

DenisChenu

DenisChenu

2020-09-10 18:04

developer   ~59773

The part about newtest=Y is realmly the minor issue of the attribute

https://bugs.limesurvey.org/view.php?id=16634#c59735

gabrieljenik

gabrieljenik

2020-09-11 14:39

manager   ~59776

@DenisChenu
I agree it should be a plugin. Decoupling seems good idea.

gabrieljenik

gabrieljenik

2020-09-11 22:10

manager   ~59781

Each timer registers itself in a local storage item identified by the Survey ID.
This is used by the reset function to know which timers belong to the survey and are to be reset.
The reset method was replaced by a function (in survey.js instead of timer.js) that reset all timers for a given survey.
Also reviewed the reset method for preview mode.

After this is tested, I will implement on LS4.
PR: https://github.com/LimeSurvey/LimeSurvey/pull/1590

DenisChenu

DenisChenu

2020-09-12 13:15

developer   ~59782

in survey.js instead of timer.js

Why ? Why not in timer.js ?

gabrieljenik

gabrieljenik

2020-09-14 16:05

manager   ~59789

Timer.js is only loaded when questions with time control are loaded.
Reset happens at thevery begining, when timer is still not available.

Also, we wrapped a variable in a function.
The variable was in survey.js, so as to keep status quo, we leave it on the same file :)

DenisChenu

DenisChenu

2020-09-14 18:03

developer   ~59790

Oh sh… i dislike to have something in survey.js for a question attribute.

I already check attribute in survey in one of my plugins to do something before start.

gabrieljenik

gabrieljenik

2020-09-29 08:24

manager   ~59974

Fix committed to 3.x-LTS branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=30523

lime_release_bot

lime_release_bot

2020-10-05 08:36

administrator   ~60066

Fixed in Release 3.23.7+201006

Related Changesets

LimeSurvey: 3.x-LTS 54ed33fd

2020-09-29 08:24:50

gabrieljenik


Committer: GitHub Details Diff
Fixed issue 16634: Timer not getting reset after completion of the survey (running multiple surveys on the same browser) (#1590)

Each timer registers itself in a local storage item identified by the Survey ID.
This is used by the reset function to know which timers belong to the survey and are to be reset.
The reset method was replaced by a function (in survey.js instead of timer.js) that reset all timers for a given survey.
Also reviewed the reset method for preview mode.
Affected Issues
16634
mod - application/controllers/survey/index.php Diff File
mod - application/helpers/frontend_helper.php Diff File
mod - application/helpers/qanda_helper.php Diff File
mod - application/views/survey/questions/question_timer/timer_footer.php Diff File
mod - assets/packages/limesurvey/survey.js Diff File
mod - assets/packages/questions/timer/package-lock.json Diff File
mod - assets/packages/questions/timer/src/main.js Diff File
mod - assets/packages/questions/timer/src/timeclass.js Diff File
mod - assets/packages/questions/timer/timer.js Diff File
mod - assets/packages/questions/timer/timer.min.js Diff File

Issue History

Date Modified Username Field Change
2020-09-02 17:57 MeirOverferst New Issue
2020-09-02 17:57 MeirOverferst File Added: limesurvey_survey_336813.lss
2020-09-02 18:00 cdorin Note Added: 59684
2020-09-02 18:01 cdorin Assigned To => gabrieljenik
2020-09-02 18:01 cdorin Priority none => normal
2020-09-02 18:01 cdorin Status new => assigned
2020-09-02 18:01 cdorin Zoho Sprints => |Yes|
2020-09-02 18:10 cdorin Relationship added related to 16635
2020-09-02 21:38 gabrieljenik Note Added: 59694
2020-09-03 21:03 gabrieljenik Note Edited: 59694
2020-09-03 21:05 gabrieljenik Note Added: 59699
2020-09-04 09:26 DenisChenu Note Added: 59706
2020-09-04 12:57 cdorin Note Added: 59707
2020-09-04 13:02 DenisChenu Note Added: 59708
2020-09-04 17:54 gabrieljenik Note Added: 59710
2020-09-04 17:54 gabrieljenik Note Edited: 59710
2020-09-04 17:57 DenisChenu Note Added: 59711
2020-09-04 17:58 DenisChenu Note Edited: 59711
2020-09-05 04:17 gabrieljenik Note Edited: 59710
2020-09-07 15:42 ollehar Note Added: 59724
2020-09-07 15:51 DenisChenu Note Added: 59725
2020-09-07 15:52 ollehar Note Added: 59726
2020-09-08 01:18 gabrieljenik Note Added: 59728
2020-09-08 08:25 DenisChenu Note Added: 59732
2020-09-08 10:30 ollehar Note Added: 59733
2020-09-08 10:36 DenisChenu Note Added: 59734
2020-09-08 10:36 DenisChenu File Added: Capture d’écran du 2020-09-08 10-36-38.png
2020-09-08 10:42 DenisChenu Note Added: 59735
2020-09-08 10:43 DenisChenu Note Edited: 59735
2020-09-08 10:45 ollehar Note Added: 59736
2020-09-08 10:48 DenisChenu Note Added: 59737
2020-09-08 10:49 ollehar Note Added: 59738
2020-09-10 17:48 gabrieljenik Note Added: 59771
2020-09-10 17:50 cdorin Note Added: 59772
2020-09-10 18:04 DenisChenu Note Added: 59773
2020-09-11 14:39 gabrieljenik Note Added: 59776
2020-09-11 21:52 gabrieljenik Summary Timer not working when survey is active (when executing the survey multiple times in the same browser/tab) => Timer not getting reset after completion of the survey (running multiple surveys on the same browser)
2020-09-11 22:10 gabrieljenik Note Added: 59781
2020-09-12 13:15 DenisChenu Note Added: 59782
2020-09-14 16:05 gabrieljenik Note Added: 59789
2020-09-14 18:03 DenisChenu Note Added: 59790
2020-09-29 08:24 gabrieljenik Changeset attached => LimeSurvey 3.x-LTS 54ed33fd
2020-09-29 08:24 gabrieljenik Note Added: 59974
2020-09-29 08:24 gabrieljenik Resolution open => fixed
2020-10-05 08:36 lime_release_bot Zoho Sprints Yes => |Yes|
2020-10-05 08:36 lime_release_bot Note Added: 60066
2020-10-05 08:36 lime_release_bot Status assigned => closed