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.

Comments

johnennew’s picture

Component: Code - Quiz module » Code - Import/Export
Status: Active » Needs review
chertzog’s picture

Version: 6.x-4.1 » 7.x-4.x-dev

Any chance of getting this patch ported to the D7? I would be glad to help test.

johnennew’s picture

Here 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

chertzog’s picture

At first testing, looks good. Will be further testing this week.

sivaji_ganesh_jojodae’s picture

Status: Needs review » Postponed

I wish not to add this feature now perhaps in next minor release.

annikaC’s picture

Version: 7.x-4.x-dev » 7.x-4.0-alpha9
Status: Postponed » Needs review
StatusFileSize
new6.05 KB

Attached is #3 redone to work with 7.x-4.0-alpha9.

sharique’s picture

Any plan to include this in next release??

dadderley’s picture

Let 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.

Marcus 78’s picture

Tried 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.

djdevin’s picture

Component: Code - Import/Export » Code - Quiz core
Status: Needs review » Closed (won't fix)

I 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.