Hello,

I would like to know if there is some way of grouping the possible answers for the questions forming a quiz in "categories". The idea is that each question would have multiple choices with single choice, that would be in a category. Then, a score for each question category would be calculated, so the results would be something like:

Category A: 5 Pt
Category B: 17 Pt
Category C: 1 Pt

The user would not know what are the categories of its choices until the quiz is corrected.

I have installed Quiz and taken a look at the documentation, and I can't figure any way to get this achieved with quiz... but I don't know if the API would let me write a module allowing this behaviour. Would one of the default Quiz question modules be helpful to serve me as example on programming it?

Comments

7magnus’s picture

looking for the same thing.

Wallack’s picture

Yeah I need something similar to have more options to show the results. Now we can only show the results pending in an overall percentaje but we cannot show a result depending on the different categories score ...

fp’s picture

Some possible solutions: http://groups.drupal.org/node/26600

captainack’s picture

Version: 6.x-4.0-rc9 » 6.x-4.x-dev
Component: Miscellaneous » Code - Quiz module
Category: support » feature

I was hoping for the same thing. It's clearly not a feature yet. It could be, but it seems like quite a complex thing to do right, considering the complexities it would add to the UI, etc.

Maintainers, do you think this is something we could make available as an advanced feature for developers who want to maintain their own scoring via taxonomy, or any other crazy ideas we haven't come up with yet, via a couple well-placed hooks?

i.e.
inside quiz.module: quiz_calculate_score():

    if (function_exists($function)) {
      $score = $function($quiz, $question->question_nid, $question->question_vid, $rid);
      // Allow for max score to be considered.
      $scores[] = $score;
    }
    else {
      drupal_set_message(t('A quiz question could not be scored: No scoring info is available'), 'error');
      $dummy_score = new stdClass();
      $dummy_score->possible = 0;
      $dummy_score->attained = 0;
      $scores[] = $dummy_score;
    }
//INVOKE HOOK HERE TO PROCESS ONE QUESTION, INCLUDING $scores, $quiz, $question, $rid ... 
    ++$count;
  }
  // 3. Sum the results.
//INVOKE HOOK HERE TO FINALIZE RESULTS
  $possible_score = 0;
  $total_score = 0;
  $is_evaluated = TRUE;
  foreach ($scores as $score) {
    $possible_score += $score->possible;
    $total_score += $score->attained;
    if (isset($score->is_evaluated)) {
      // Flag the entire quiz if one question has not been evaluated.
      $is_evaluated &= $score->is_evaluated;
    }
  }

  // 4. Return the score.

I smell some delicious quiz scoring modules cooking ;).

djdevin’s picture

Component: Code - Quiz module » Code - Quiz core
Issue summary: View changes
Status: Active » Closed (outdated)

Easy with Views now.

jshosseini’s picture

how it can be done by views?