This is a patch submission to allow quiz questions to exist on their own outside of a quiz. I'm afraid I've only done it for Quiz 4.1 but if you'd like I can have a go at patching a later version.
This follows the forum discussion at http://groups.drupal.org/node/106379#comment-525524
The functionality of this is:
* Admin can create a question in the usual way but it does not have to be a member of a quiz
* If question is not a member of a quiz then the question appears to normal users allowing them to answer it. On submit they immediately get the feedback
* The user's answer is not recorded and so cannot be viewed in any quiz report view. (The quiz result storage mechanism is bypassed)
* If the question is a member of a quiz or later becomes a member of a quiz, normal users get an access denided message when trying to view the question node directly. This is because they would be able to get the answer to the question by answering it as a question and then could take it in the quiz and get the answer right.
* Normal users can answer standalone questions (questions not members of a quiz) as many times as they like
The reason behind allowing quiz questions outside of a quiz is that it allows learning without assessment.
The patch alters the question_types/quiz_question/quiz_question.module file only. The functions touched are:
* quiz_question_view - normal view mode now checks if the question is in a quiz. If not, it shows the answering form or checks if the form has been submitted. If it has been submitted it shows the report form.
* quiz_question_report_form - sets the score weight of the question to 1 if its a standalone quiz question.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | quiz_questions_work_outside_quiz_7.x-4.0-alpha9-1194158-6.patch | 6.05 KB | annikaC |
| #3 | quiz_questions_work_outside_quiz_7.x-4.x-dev-1194158-3.patch | 6.01 KB | johnennew |
| quiz_question_4.1.patch | 5.81 KB | johnennew |
Comments
Comment #1
johnennew commentedComment #2
chertzogAny chance of getting this patch ported to the D7? I would be glad to help test.
Comment #3
johnennew commentedHere is a patch for the 7.x-4.x branch. The score displayed for true false questions has a problem as true false response seems to take a different variable type to the others (answer is an integer and not an array). Let me know how you get on.
Kind regards
John
Comment #4
chertzogAt first testing, looks good. Will be further testing this week.
Comment #5
sivaji_ganesh_jojodae commentedI wish not to add this feature now perhaps in next minor release.
Comment #6
annikaC commentedAttached is #3 redone to work with 7.x-4.0-alpha9.
Comment #7
sharique commentedAny plan to include this in next release??
Comment #8
dadderley commentedLet me add my vote. This would be a very nice feature.
I have been looking at the https://drupal.org/project/closedquestion module for this exact reason. It allows allows learning without assessment.
Comment #9
Marcus 78 commentedTried this on a testsite with just this module.
When I try to remove a question that is associated to a quiz I get this
PDOException: SQLSTATE[22012]: Division by zero: 1365 Division by 0: UPDATE {quiz_node_results} SET score=ROUND( 100 * ( SELECT COALESCE (SUM(a.points_awarded), 0) FROM {quiz_node_results_answers} a WHERE a.result_id = {quiz_node_results}.result_id ) / ( SELECT max_score FROM {quiz_node_properties} qnp WHERE qnp.vid = {quiz_node_results}.vid ) ) WHERE (vid IN (:db_condition_placeholder_0, :db_condition_placeholder_1)) ; Array ( [:db_condition_placeholder_0] => 1 [:db_condition_placeholder_1] => ) in quiz_update_max_score_properties() (line 2610 of /Applications/MAMP/htdocs/sandbox/sites/all/modules/quiz/quiz.module).
To clearify this doesnt appear when you delete a question thats outside of a quiz.
Comment #10
djdevinI think https://www.drupal.org/project/closedquestion is a better solution here.
Implementing this here may break certain question types that depend on the question being in a quiz.