It is originally a request from client...

Functionally the request is to add a checkbox to question form while taking quiz. The checkbox to be ticked by user if he/she is not sure about the answer at the time of taking quiz. The could be used later by student to refer and learn the answer (sort of bookmark), also for the tutors to conduct another round of quiz with doubtful questions from view.

Files: 
CommentFileSizeAuthor
#3 quiz_take.js_.txt450 bytessivaji@knackforge.com

Comments

sivaji@knackforge.com’s picture

Status:Active» Fixed

Just committed the code pertaining to this feature to git.

Status:Fixed» Closed (fixed)

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

sivaji@knackforge.com’s picture

Status:Closed (fixed)» Needs work
StatusFileSize
new450 bytes

JS file added as a part of this feature was missed out when committing the code to repository. Reopening the issue to follow up for the same.

sivaji@knackforge.com’s picture

Status:Needs work» Fixed

Added the missed out js file to git and updated the quiz report template to show questions marked as doubtful in report view.

Status:Fixed» Closed (fixed)

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

  • Commit c1842a0 on 7.x-4.x, 7.x-5.x by sivaji:
    Fix #1876104 - Add option to mark a question as doubtful while answering...
  • Commit f05e2e3 on 7.x-4.x, 7.x-5.x by sivaji:
    Issue #1876104 by sivaji: Added option to mark a question as doubtful...

  • Commit c1842a0 on 7.x-4.x, 7.x-5.x, quiz-pages by sivaji:
    Fix #1876104 - Add option to mark a question as doubtful while answering...
  • Commit f05e2e3 on 7.x-4.x, 7.x-5.x, quiz-pages by sivaji:
    Issue #1876104 by sivaji: Added option to mark a question as doubtful...

  • Commit c1842a0 on 7.x-4.x, 7.x-5.x, quiz-pages, 2269219 by sivaji:
    Fix #1876104 - Add option to mark a question as doubtful while answering...
  • Commit f05e2e3 on 7.x-4.x, 7.x-5.x, quiz-pages, 2269219 by sivaji:
    Issue #1876104 by sivaji: Added option to mark a question as doubtful...

  • Commit c1842a0 on 7.x-4.x, 7.x-5.x, 2269219 by sivaji:
    Fix #1876104 - Add option to mark a question as doubtful while answering...
  • Commit f05e2e3 on 7.x-4.x, 7.x-5.x, 2269219 by sivaji:
    Issue #1876104 by sivaji: Added option to mark a question as doubtful...
andeersg’s picture

Issue summary:View changes

Can this feature be used to something? As far as i can see the user must remember which questions they thought were doubtful anyway, case the "jumper-feature" does not display doubtful answers?

ezraw’s picture

Agreed. Mark doubtful seems very specific to a particular use case. What if it was more generic, something like "Bookmark," "Bookmark for later" or "I want to return to this question for further consideration?"

And then couple this with a view of the marked questions available from a utility navigation item.

andeersg’s picture

I found a solution for my self, by using the theme function for the jumper, i think it could have been done better, but it works.

<?php
function mytheme_quiz_jumper($vars) {
 
$quiz = array();

  foreach (
$_SESSION as $key => $value) {
    if (
is_array($value) && isset($value['result_id'])) {
     
$quiz = $value;
    }
  }
  if (empty(
$quiz)) {
   
$current = $vars['current'];
   
$num_questions = $vars['num_questions'];
   
$output = '<select name="quiz-jumper" class="form-select" id="quiz-jumper">';
    for (
$i = 1; $i <= $num_questions; $i++) {
     
$extra = $i == $current ? ' selected="selected"' : '';
     
$output .= '<option value="' . $i . '"' . $extra . '>' . $i . '</option>';
    }
   
$output .= '</select><span id="quiz-jumper-no-js">' . $current . '</span>';
  }
  else {
   
//dpm($vars);
    //dpm($quiz);
   
$all = array_merge($quiz['previous_quiz_questions'], $quiz['quiz_questions']);
   
//dpm($all);

   
$current = $vars['current'];
   
$y = 1;
   
$output = '<select name="quiz-jumper" class="form-select" id="quiz-jumper">';

    foreach (
$all as $question) {
     
$extra = $y == $current ? ' selected="selected"' : '';
      if (
mytheme_check_if_doubt($quiz['result_id'], $question['nid'], $question['vid'])) {
       
$output .= '<option value="' . $y . '"' . $extra . '>' . $y . ' - In doubt</option>';
      }
      else {
       
$output .= '<option value="' . $y . '"' . $extra . '>' . $y . '</option>';
      }
     
$y++;
    }
   
$output .= '</select><span id="quiz-jumper-no-js">' . $current . '</span>';
  }
 
drupal_add_js('
    (function ($) {
      Drupal.behaviors.quizJumper = {
        attach: function(context, settings) {
          $("#quiz-jumper:not(.quizJumper-processed)", context).show().addClass("quizJumper-processed").change(function(){
            $("[name=jump_to_question]").val($(this).val());
            $("#edit-submit").trigger("click");
          });
          $("#quiz-jumper-no-js:not(.quizJumper-processed)").hide().addClass("quizJumper-processed");
        }
      };
    })(jQuery);
  '
, array('type' => 'inline', 'scope' => JS_DEFAULT));
  return
$output;
}

function
mytheme_check_if_doubt($res_id, $quiz_nid, $quiz_vid) {
 
$result = db_select('quiz_node_results_answers', 'q')
    ->
fields('q')
    ->
condition('result_id', $res_id,'=')
    ->
condition('question_nid', $quiz_nid,'=')
    ->
condition('question_vid', $quiz_vid,'=')
    ->
execute()
    ->
fetchAssoc();

  if (isset(
$result) && $result['is_doubtful'] == 1) {
    return
TRUE;
  }
  else {
    return
FALSE;
  }
}
?>

I feel this is a little hacky, but it seems to work.

carlospdl’s picture

andeersg & ezraw.

The doubtful mark is usefull when the concepts covered by question need to be reinforced.

The student answer the question but "not sure" about "why this answer". He/she needs to review the theory/concetps behind the question.

Once quiz has been completed, the student/tutor can review all doubtful question to reinforce concepts.