Hi:

Would be great that quiz module notificate to the other modules when a user has finished a quiz. I made a simple patch that makes that (with a call to invoke_all).

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mbutcher’s picture

In the 3.x branch, we use triggers/actions to handle this (I think there is an example). The nice thing about this method is that it makes it possible to configure the actions from the admin interface. However, before it is really useful, some actions need to be developed. (I believe sivaji is working on adding mail notification as an action.)

If there is a good argument to be made for adding a hook invocation too, I'm open to considering adding this as well.

manolopm’s picture

We think, and we use, for integration with gradebook module. When the quiz is finished the activity can be updated with the grade of the quiz.

mbutcher’s picture

That is a good case for adding a hook there. I'll think about this.

I would probably only add it into Quiz 3, since Quiz 2 is now completely frozen except for bug fixes. However, Quiz 3 is due out soon, so it wouldn't be a long wait.

I'm thinking of maybe adding these new hooks:

hook_quiz_begin()
hook_quiz_finished()
hook_quiz_forward_question() - called when a user advances one question forward.
hook_quiz_back_question() - called when a user goes back a question.

These last two would make finer grained timing possible.

What do you think?

Matt

mbutcher’s picture

Version: 6.x-2.1 » 6.x-3.x-dev
Assigned: Unassigned » mbutcher
Status: Active » Fixed
Issue tags: +hook_quiz_begin, +hook_quiz_finished

hook_quiz_finished has been added to the 3.x branch. It will fire *AFTER* the quiz trigger (e.g. after all actions are executed).

hook_quiz_begin() has also been added to the 3.x branch. it will fire immediately before the user sees their first question.

Sivaji_Ganesh_Jojodae’s picture

FileSize
2.23 KB

Hello folks

I have attached a quiz results notification mock-up patch. This patch will send an email containing quiz title, description, number of questions, percentage of marks scored etc at the end of the quiz. I would like to know your suggestions regarding this.

Thanks
Sivaji

mbutcher’s picture

Status: Fixed » Needs work

Before I can apply the patch, we need to add a way of turning the feature on and off. That is, not everyone would want to have quiz results automatically emailed -- especially if essay questions were unscored (and hence show up as 0 points).

If Triggers/Actions won't work, then we should at least add an administrative interface for turning this feature on and off. See quiz_admin_settings() for a starting point.

Sivaji_Ganesh_Jojodae’s picture

Assigned: mbutcher » Sivaji_Ganesh_Jojodae
Status: Needs work » Needs review
Issue tags: +gsoc, +gsoc2009

This patch has been committed with on/off feature. I like to extend this to have configurable email body. Changing the status to need review.

Sivaji_Ganesh_Jojodae’s picture

Status: Needs review » Fixed

There is no bug reported on this, changing the status to fixed.

Status: Fixed » Closed (fixed)
Issue tags: -notifications, -actions, -hook_quiz_end, -hook_quiz_begin, -hook_quiz_finished, -gsoc, -gsoc2009

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