thanks for this great module. Based on my experience working to make this module work with Quiz 5.x, tincan_api quiz is supporting only 4.x atm?
I've been working to use the tincanapi_quiz module with Quiz 5.x
There are a few issues, some of which I have worked through myself, but I thought I'd seek out some advice for the big one.
When reporting of questions 'answered' events/verbs is not including the proper result object values for these statements.
Tracing it down a bit, it looks like the scores haven't been processed at the time that the hook_quiz_finished() implementation is fired.
tincanapi_quiz_quiz_finished()
looking into _tincanapi_quiz_track_answers($quiz, $rid);
this is called: $questions = _quiz_get_answers($quiz, $rid);
but the $questions->answers array is not set or populated.
I wonder what may be the best approach...
or...put the logic that is in that hook, into a hook_quiz_scored() implementation?
but would that function fire more often or not at the right time....obviously we'd hope that when the quiz is finished the scoring would be available...
Thoughts on using a hook_quiz_scored implementation vs the current hook_quiz_finished() implementation?
Is this something you'll have encountered or thought about?
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | tincanapi_quiz5-2.x.zip | 3.74 KB | markusa |
| #4 | tincanapi_quiz5.zip | 3.27 KB | markusa |
Comments
Comment #2
markusa commentedI see that hook_quiz_scored() is implemented, its just not firing...
maybe quiz 5.x doesn't fire that hook anymore?
Comment #3
markusa commentedcreated an issue in the Quiz module issue queue, I think I've stepped into the tar pit trying to use Quiz 5.x
https://www.drupal.org/node/2609350
Will document my adventures as solutions present themselves
Comment #4
markusa commentedAttached is a tincanapi_quiz5 module, that almost duplicates all the functionality of the tincanapi_quiz module, but tailored to Quiz 5.x
The main difference is that in Quiz 5.x hook_quiz_scored() and hook_quiz_finished() are deprecated. Some database table column names had changed as well.
This module also fires off statements for the user's answer interactions immediately, instead of at the finish time of a quiz.
This module is working for us right now...
but will not respond to manually evaluated score updates...
See this issue in the Quiz 5.x issue queue for developments:
Quiz Result entity hooks not firing on manual evaluation score update
If you use this module, do not have the tincanapi_quiz sub-module enabled, the posted module was made not to depend on it....
Comment #5
fuzzy76 commented+1 for this, quiz 5.x is the recommende branch on their project page (though not the recommended release for some reason).
Comment #6
nve commentedAs the changes aren't that big, is it possible that we support 4.x and 5.x in one module? I will look at it after it has been ported to 2.0 (as we will keep 1.0 frozen)
Comment #7
markusa commentedHere's a version we have used successfully with TinCan API 2.x and Quiz 5.x for 1 year now on a heavy traffic client site.
I chose to use
https://www.drupal.org/project/hook_post_action
To implement hook_entity_postupdate() instead of hook_entity_update().
The Hook Post Action module hooks fire after the data is actually committed to the database, hook_entity_update() does not. An entity does not commit its db transaction until the object goes out of scope, that is after all the hook_entity_update() implementations, in other modules have run, and there can be rare, but troublesome and difficult to diagnose race conditions if you need access to the actual SQL database of the node_quiz_result table. I use the Drupal based Tin Can LRS, not Learning Locker, and I can respond to an incoming Tin Can statement, and if you need to look at node_quiz_result table data, in the hook implementation triggered by the statement, the current data will not be there. It is a race condition.
You may not need that, you can see in the code easily enough now to switch to hook_entity_update() and not need Hook Post Action as a dependency. Up to you, maybe give the option.
I hope some variation or this module or something gets into the official version of this module, because everyone uses Quiz 5 now.
Here's the zip file of the module.....
tincan_quiz5-2.x-zip
If you'll want some help maintaining this module, I'd be happy to lend a hand. Are you looking for co-maintainers?