Hi everyone,

I'm part of the Opigno team (https://www.drupal.org/project/opigno_lms).
We are currently using the quiz module. I noticed that some maintainers of your project are also maintainers of the quiz module.
I was wondering if you guys plan on adding support for H5P as a quiz question type. Getting the results and scoring as we did with scorm.

Best regards

CommentFileSizeAuthor
#6 quiz-h5p.png104.29 KBdjdevin
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

sylvaticus’s picture

+1.. content creation is the bottleness in today elearning and that's exactly what it's covered by h5p..

djdevin’s picture

I'm the current maintainer of the Quiz module, I would be happy to help.

I envision a custom question type that lets you select an H5P content type to use when you create it.

Quiz would deal with the attempts and overall grading, H5P would deal with the content and returning something back to Quiz.

We are doing a lot of work on the 7.x-5.x branch so everything is a lot more flexible now.

Let me know if you need any assistance or drop by #drupal-course/edu on IRC.

falcon’s picture

@djdevin we've been thinking about this for some time now. We've also been thinking about having H5P as a field type instead of a content type.

At the moment we're adding xAPI support which might be used in a Quiz integration. It might even be possible to replace all the quiz content types with H5P content types in the future, but it will at least require that H5P doesn't evaluate responses client side but just sends the users answers to the server and the answers gets evaluated and stored there.

So to move things forward we need a plan with a time schedule.

One approach might be to let quiz handle any node types as question types given that the node has xAPI support? Another would be to create a question type that serves as a interface between H5P nodes and quiz?

djdevin’s picture

It sounds like a question type with an H5P field (or whatever it ends up being) would be the best and most abstract way to do it. Or maybe multiple question types dynamically generated from the available H5P types.

I see you just had a 1.0 release so I'll try to find some time and go play around.

djdevin’s picture

I did some work in #2383029: Support for H5P integration against the current H5P 1.0.

I was able to get an H5P question type created and put it into a Quiz, including multiple H5P content types on a page (multiple H5P questions) and have it graded based on the points returned from H5P. So you create the H5P question, select the H5P content type, do your edits, then you can add it to the Quiz.

I see some issues though, maybe not with the H5P project but regarding the Quiz/H5P integration. These are some of the bigger issues:

1) The node-only approach may be problematic in the future, having it be a field would be great so that we can create a custom question node/entity/whatever it ends up being later, belonging to Quiz. I was able to get around it by making some changes to Quiz so that the H5P content type could also exist as a question type and not get clobbered by quiz's legacy hook_node_info().

2) I don't see a maximum score for an H5P question. I do see one for the response (so when you answer a question, the points earned and the max points are written). Quiz needs the max score before it deals with the answer. The max score can be overridden but it's suggested by the Question type module, so with H5P it's always 0. Maybe this is Quiz-specific and should not be a part of the H5P project. We could always get around this by working to delay the max score calculation until an answer is present.

3) Quiz lets you optionally retake Quizzes and keep the results, however H5P only supports one attempt per type. So re-taking the Quiz has no effect on the score, the same score from last time is displayed since we are checking {h5p_points} instead of the submitted form values (since the H5P stuff is not a form). We might be able to fix this by somehow reading the most recent data written by the H5P type instead of its destination (the {h5p_points} table) but I haven't looked that far yet. Currently I am just passing the "content_id" as the "answer" to Quiz, so that the Response classes can look up the H5P data that the user submitted. But since "content_id" does not change across Quiz attempts it pulls the same value.

Some of the very Quiz-specific issues:
4) Quiz has a *lot* of complicated taking behaviors and granular feedback options, like when to show correct answers, points awarded, feedback, prepopulate correct answers, etc. I'm not sure how/if that can play into H5P, or if this is a "H5P will override these settings" sort of thing.

5) The quiz results page, and also the Quiz engine in general supports resuming a question which I haven't been able to figure out how to do (preloading response from database).

I haven't dug in too deep, these are just my initial findings.

djdevin’s picture

FileSize
104.29 KB

falcon’s picture

Your patch looks lovely. I've tested it and it works fine. I actually had to read the code twice to figure out how you connected the H5P module, I though the H5P content type was simply named "H5P" but obviously it's named "h5p_content". I would expect the integration to be more extensive. Great job!

Regarding your points:
1) I think your approach is neat for the time being. We might add fields support for H5P but we'll continue to maintain the content type.

2) We're planning to add max scores to the questions and back-end calculations of the scores late next year. Currently we'll have to do it the way you suggests I think :/

3) @jamesap from Opigno has made a foundation for being able to store the results for several H5P attempts here: https://github.com/falcon-git/quiz_h5p I think we can build that into quiz_h5p and make quiz able to store several attempts.

4) H5P has its own question containers and they will now be able to override H5P questiontypes settings for retry enabled and solutions enabled. Quiz could do the same and override these options at least and maybe more to come. We'll add a "contracts" concept for H5P next year. One contract might be "QuestionType 1.0" and Quiz could choose to only support H5Ps that implements that contract and use the contract to customize the questiontypes behaviour.

5) Resuming won't be possible as of yet but this is also something we plan to support later.

I suggest that we do the following now:
1. @jamesap and @djdevin have created a great foundation for an H5P quiz integration
2. We create an H5P branch from the 7.x-4.x branch (in order to support Opigno)
3. We port @djdevin patch and adds it to that branch
4. We merge in the tables and functions from @jamesap
5. We make it so that
5.1. H5P nodes may be created and added to Quizzes (the @djdevin way)
5.2. Individual results are stored for each attempt (combine @djdevin way and @jamesap)
5.3. The user is somehow warned that H5P "questions" works a bit differently. They doesn't follow the quizzes settings and its possible for end users to store incorrect results in the database if they are computer savvy.
5.4. Add some more hooks and polish (probably need to act on deletes and stuff?)
(5.5. Maybe add some overriding for retry and show solution)

Does this sound reasonable? I'll get some of the stuff above done next week if there are no objections

djdevin’s picture

I only tested it in 5.x, so I guess its good that it works in 4.x too!

I think we should not include it in the Quiz project and let it live in its own project. I'm currently debating moving the quiz_ddlines to its own project as well and just keeping the core basic question types. This is to keep the codebase small enough so that there aren't huge blockers related to more complex question types holding back major version releases. 4.x is not getting any new updates so it doesn't really make sense to add new functionality there. I will however add the minor changes (in 4.x and 5.x) from the patch that allow for a foreign content type to be used as a Quiz question without Quiz globbing all over it.

Other than that I think all the other ideas are fine, we won't see a move away from node questions until 7.x-6.x anyway, so having a new Quiz H5P Question project that works with both 4.x and 5.x I think would be the ideal solution.

falcon’s picture

Ok, I was at my cabin this weekend and did the H5P branch from 7.4. The patch couldn't be used as is, but I made a few modifications to it. Pushed the work when I got home. Thought you wanted it in quiz since your patch was based on quiz, but let's consider where to put the code once we have it up and running. It currently works, but needs several improvements.

falcon’s picture

Pushed some new changes to the H5P branch of Quiz now.

What's left?
1. Testing!
2. Add a new hook to H5P making it easier for other modules to modify the content
3. Make quiz control show solution settings, and always disable H5P's own retry function when possible.

djdevin’s picture

1. We have a ton of automated tests for Quiz now so let's add to that. It might be hard to test the H5P library but we can at least simulate the actions in some way.

2. I believe most of the changes with content/teaser rendering are already possible in 5.x since we use more of the Drupal APIs for that.

3. We should probably make it 5.x compatible, 4.x will most likely be deprecated soon and there's a solid upgrade path. 'tries' is dead among other things related to the old quiz_take_quiz() that make it possible to do pagination and provide more feedback options. Along with just about everything in 5.x that was refactored.

Some things like this changed too:

        'question_nid' => $this->question->nid,
        'question_vid' => $this->question->vid,
        'result_id' => $this->rid,

It was normalized to just result_answer_id in #2391723: Normalize data storage for question responses and nid/vid is becoming qid in #2399209: Remove redundant nid/vid fields in questions for the new Entity work.

I can make these changes if you want since I'm more familiar with 5.x. I think I'd still prefer the project be on its own, so any new maintainers for Quiz don't have to inherit all the question types as well.

falcon’s picture

Status: Active » Fixed

Integrated with Quiz 4. Will be integrated with Quiz 5 as well when we've got some feedback from the Quiz 4 usage.

Status: Fixed » Closed (fixed)

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

SanathDrupalSitebuilder’s picture

Hi,

I'm implementing an online test in my website using quiz5 module(drupal 7.41). Everything works fine but I have a problem with displaying the questions to the user. This(quiz) module is not allowing me to display more than one question per page. I just want to know any alternatives to display at-least 5 questions per page using the quiz5 module.

When a particular test has time limits with more than 100 questions test users are experiencing more time wastage in page reload while switching to the next question. I just need a better solution to solve this.

djdevin’s picture

Please ask your question in the https://www.drupal.org/project/quiz project unless you are using this question type (H5P). If you are using this question type then please post it to https://www.drupal.org/project/quiz_h5p

Just a hint though, only Quiz 5 supports more than 1 question per page.

Edit: I saw that you are running Quiz 5, all you have to do is enable the "quiz_page" module and you will be able to add pages of questions.

Frontmobe’s picture

Hi djdevin,

In #6 the image included tells me that you were able to get at least 1 question to "score" in your quiz, since the question is marked "Score 1 out of 1". I am having trouble getting h5p questions to register scores when included in a quiz (either quiz 4 or 5). The h5p questions do record scores (h5p_points table in de db) for the h5p module when I disable quiz module.

Could you tell me how you got this to work or point me in the right direction maybe? Am I right in assuming this is controlled in the integration module https://www.drupal.org/project/quiz_h5p (for quiz 5 only of course)?

Any help with this will be greatly appreciated, thanks!!

Frontmobe’s picture

I figured out that h5p scores get evaluated correctly in Quiz 5 when I turn of Bootstrap theme and make Bartik the default theme again!

I found a similar issue here: https://h5p.org/node/2136 , what would be the best approach to get this working with Bootstrap enabled? Or am I right to conclude that using h5p questions in Quiz 5 is currently not possible when already using Bootstrap as a theme?

Thanks!
Marco

falcon’s picture

There are solution suggestions in the H5P.org page you linked to, disabling fast click. I haven't checked if that applies for more recent versions of Bootstrap. It seems that it is a Bootstrap bug so there isn't much we can do from Quiz / H5P.

falcon’s picture

@Frontmobe are you having trouble recording scores in the latest version of Quiz 4 with the quiz_h5p module included there?

Frontmobe’s picture

Hi falcon,

I was having trouble recording scores in the latest versions of Quiz 4 and 5 when using Bootstrap as a theme.

It appears that updating the version of jQuery to at least 1.7 did the trick!! In the console I saw that several javascript functions did not work properly. I can confirm that using H5P questions in Quiz4/5 now works perfectly fine when it comes to evaluating scores.

Thanks for your reply!

Cheers,
Marco