When user logs out before completing quiz, if they come back and click "start" they get two messages:

You are resuming a quiz
You have run out of time

I do not have timed quizes and I allow 1 take, and allow resume. But logging out eats up the user's one time. A session ending should not end the quiz. This also does not show any results of the few questions they did answer.

Files: 
CommentFileSizeAuthor
#13 quiz-allow_resume-1792932-13.patch654 bytesperelman.yuval

Comments

Any suggestions?

I have a similar problem that when the user logs out and then comes back to resume the quiz the quiz gets automatically submitted for them and they don't have the chance to finish.

Priority:Normal» Major

Any way to solve this?

Same problem in Quiz 7.x-4.x-alpha9. In my case I have an external auth system (Shibboleth) that times out a user's session if their IP address changes or they are inactive for a time. When they return, their in-progress sessions have automatically skipped ahead.

I've been looking into this since it is a fairly significant usability issue. We've band-aided the issue by allowing unlimited takes, but this is a kludge. If I come up with anything I'll post here.

Ok, here's what I have tried so far, and this seems to be working for me. What appears to be nuking the user's in-progress sessions is an if clause around line 2026 of quiz.module:

i

<?php
f
($time <= 1) {
       
// Quiz has been timed out, run a loop to mark the remaining questions
        // as skipped.
       
quiz_jump_to(count($_SESSION['quiz_' . $quiz->nid]['quiz_questions']) + count($_SESSION['quiz_' . $quiz->nid]['previous_quiz_questions']) + 1, $quiz, $_SESSION['quiz_' . $quiz->nid]['result_id']);
       
$quiz_end = TRUE;
        unset(
$content['progress']);
        
$show_validation_message = FALSE;
       
drupal_set_message(t('You have run out of time.'), 'error');
      }
?>

If I comment out all the lines except for the quiz_jump_to line, things work as I'd expect - A user can work on the quiz, log out, log back in, and pick back up where he/she left off. I'm pretty sure that commenting out those lines is also going to screw things up if you actually care about timed quizzes (I don't)

I wouldn't recommend this as an actual fix so I am not supplying a patch - however, this does I think help isolate where the "bug" is happening.

Priority:Major» Normal

I just took your suggestion in #5 and commented out the lines. I started a 10 question quiz, answered 3 questions, logged out and back in. Went to quiz, it had a "start" button (which should say "resume" in my opinion) so i clicked on start, it took me to questions 4 out or 10. There was also a message letting me know I was resuming a quiz already in progress. So far so good, but...

There was a message at the bottom by the 4th question which told me this was the last question. I answered the 4th question and the quiz graded me. It didn't allow me to finish. It also didn't get my last answer. It only gave me a 3 out of 10. Nor did it show me the correct or wrong answers in the results.

Thanks

All the other questions are being shown as skipped.

Any suggestions?

This is happening to us as well. Please fix this bug if you can.

Hi all
The problem is in the _quiz_resume_existing_quiz function

  // Timed quizzes are likely to have expired by this point. But we let
  // the quiz_take_quiz handler handle that.
  $_SESSION['quiz_' . $quiz->nid]['question_start_time'] = REQUEST_TIME;
  $_SESSION['quiz_' . $quiz->nid]['question_duration'] = $quiz->time_limit;

The question_duration is needed only for timed quiz but added to all quizes on resume

In the _quiz_take_quiz_init function they check for the quiz type before setting the question_duration in the session

  if ($quiz->time_limit > 0) {
    $_SESSION['quiz_' . $quiz->nid]['question_duration'] = $quiz->time_limit;
  }

So i think if you change the code from the resume function to

  if ($quiz->time_limit > 0) {
    $_SESSION['quiz_' . $quiz->nid]['question_duration'] = $quiz->time_limit;
  }
  $_SESSION['quiz_' . $quiz->nid]['question_start_time'] = REQUEST_TIME;

It will work.

I tested it and it is working well, if there is a need i can make a patch.

Patches are always welcome. Quiz could definitely use some maintainer's love. It'd be nice to get rid of the Alpha status soon.

Version:7.x-5.x-dev» 7.x-4.x-dev
Status:Active» Needs review
StatusFileSize
new654 bytes

This is the patch :)

Status:Needs review» Fixed

Patch #13 did the trick. Committed to git. Thanks.

Patch 13 works fine in my case too, Thanks for the share.

Status:Fixed» Closed (fixed)

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

#13 Works for me too. Thx !!

  • Commit 4b03c05 on 7.x-4.x, 7.x-5.x by sivaji: Issue #1792932 by perelman.yuval | IWasBornToWin: Fixed Allow resume...