Needs review
Project:
H5P - Create and Share Rich Content and Applications
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
28 Jul 2016 at 20:03 UTC
Updated:
3 Mar 2023 at 19:50 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
hosais commentedAttach a patch.
Comment #3
icc commentedThank you, we will try to review this for the next sprint.
Comment #4
partdigital commentedThis is an old issue but I was running into the same problem. I found that the content_id would always change on node save (regardless of if there were any changes to H5P or not). This would cause the user's data to become out of sync with H5P and thereby "reset" the user's data.
I created a patch which addresses this immediate issue.
It checks to see if the h5p form has changed.
Note: This is a relatively fundamental change so this could cause a regression. I also don't like adding the database query directly in H5PEditorWidget. This should be part of H5P Core. However, I understand this may be only appropriate in the context of Drupal. I'll leave it up to the maintainers to determine the best place to put that code.
I should add: this was in the Drupal 8 version of the module.
Comment #5
partdigital commentedComment #6
partdigital commentedComment #7
christophersmith262 commentedUpdated to include keeping scores when the content id changes. The rationale being that you shouldn't wipe out the results for somebody who has completed the h5p content, even if the quiz changes, authors should have to explicitly state that they want results wiped out. I believe that functionality is available as part of the h5p widget already (see "clear results").
It looks like this issue is for the 7.x branch but we are actually committing patches against 8.x, should we create a new ticket?
Comment #8
jdearie commentedI installed patch in #7 (running on a D8 site) and while it does not clear the results - it also does not listen to the reset field settings.
I added a boolean field with a machine name of field_reset_h5p_userdata, but whether the box is checked or not, the results for the quiz are never cleared.
Did I read the comment wrong? Does the patch prevent the resetting of user data UNLESS the author uses the Clear Results option within the h5p content? And therefore I don't need that reset field? Where is the Clear Results option you're referring to? I only see Clear content. (using quiz h5p content type)
Comment #9
antiorario commentedHere’s a reroll to make sure the proper translation is loaded for the original entity on D8.
Comment #10
antiorario commentedComment #11
partdigital commentedRe-rolled the patch to work with Drupal 9. I also added in a check to see if h5p_save_content_state was enabled. It doesn't make sense to attempt to update user data if we're not capturing it anyway.