It looks like what's happening is when the client-side JavaScript page detects that time runs out, it's reloading the page, and then the server-side code correctly determines that time ran out, and marks all remaining questions as having been skipped. But the JavaScript countdown code is inserted before it even checks the remaining time (so it goes in anyway). And the code that shows the next question still runs instead of the ending quiz code, regardless of whether it had just detected that time ran out. On the second page-load, the JavaScript code again detects that time ran out, shows the alert box again, and causes another reload of the page. But this time, the server-side code sees that no questions are left (since by now, they had all been blanked out when the timeout was detected before), and the quiz is finally ended.

I've attached a patch that fixes it for me.

In addition, I recommend a change in behavior. The alert box seems a bit tacky. I recommend removing it, and instead doing a drupal_set_message() to tell the user what happened. The second attached patch is meant to be applied after the first one, to show what I mean.

This issue is probably related to #460040: Countdown timer bug, but it felt right to start a new issue anyway.

Comments

sivaji_ganesh_jojodae’s picture

Status: Needs review » Fixed
Issue tags: +timer

Thanks a lot darktygur both the patches has been tested and committed to quiz 3.x (quiz 4.x as well) You keep Rocking !!
Marking this as closed if you have any problem feel free to reopen it

anil614sagar’s picture

Thanx dude it solved my problem also

Status: Fixed » Closed (fixed)
Issue tags: -timer

Automatically closed -- issue fixed for 2 weeks with no activity.