h5p / h5p-boardgame

2 stars 11 forks source link

Question set inside Boardgame shares activity id and title #3

Open garemoko opened 8 years ago

garemoko commented 8 years ago

The board game includes a question set, however the question set inside has exactly the same xAPI activity id and title as the board game. (The only way you can tell is by looking at the category context activity). The result of this is that the board game appears to send two statements about completion duplicating the data, once at the end of the question set (with the wrong category) and once after the feedback video.

Where the board game contains multiple question sets, these all share the same id.

I think the best solution here would be to use a different activity id and title for each question set. Any thoughts on how to do this?

garemoko commented 8 years ago

Note: I notice that questions within a questions et use a sub content id. Does this concept need to be extended to allow for 3 tiers?

falcon-git commented 8 years ago

Boardgame is a content type that has received very little tlc after it's birth.

However the 0bject.id seems to be different for the Question Set compared to the boardgame? And the questionset doesn't have a title? ref https://h5p.org/boardgame

What seems to be missing to me is that the questionset doesn't have it's parent set.

Maybe you're using Wordpress? We might have a bug in the Wordpress plugin.

SubContent ids are uuids, so they should be unique for all sub content independent of how many tiers we have.

To fix the problems the QuestionSet will need a getTitle function I think. See for instance https://github.com/h5p/h5p-multi-choice/blob/master/js/multichoice.js#L672 - we might also add a title field to the questionset to have the author add a title. (In boardgame the title should ideally be based on the hotspot title)

And the id problem should already be ok, but it might be that we have a problem with the Wordpress plugin?

garemoko commented 8 years ago

I am using the Wordpress plugin. None of that code touches the statement object though.

Or do you mean the main H5P plugin?

I'm more worried about the id than I am about the title.

falcon-git commented 8 years ago

Yeah, the main H5P plugin. I don't see how that one should mess it up either, but you are talking about the object.id attribute? Can you confirm that it works as expected on https://h5p.org/boardgame ?

(you can do H5P.externalDispatcher.on('xAPI', function(event){console.log(event.data.statement);}); in console)

garemoko commented 8 years ago

Yes. I am getting different object ids for the question sets there as desired. Where does that id come from to end up in the statement?

falcon-git commented 8 years ago

https://github.com/h5p/h5p-editor-php-library/blob/master/scripts/h5peditor-library.js#L146

I think I orignally created this feature, but I suspect that it got broken in a merge or something. How old is the boardgame you are using? Maybe it didn't have the subContentId? It seems that this new code won't give old content a sub content id, but new content should probably always get a subContentId and keep it?

garemoko commented 8 years ago

I installed the library and created the boardgame today.

Interestingly, if I download the game from https://h5p.org/boardgame, that works. I can't see anything in the settings that I'm missing.

falcon-git commented 8 years ago

When you download it you get the same subContentIds as used on H5P.org. seems that the generation of new ones doesn't work on your site for some reason. I'll test on our main WP test site now.

falcon-git commented 8 years ago

Are you seeing the problem in console or in your reports? On labs I got an id like this one:

http://labs.h5p.org/wp-admin/admin-ajax.php?action=h5p_embed&id=15?subContentId=f9fa5b70-d5d8-4d58-bbd1-f6e5eeb89a1d

This isn't a valid iri afaik so maybe the subContentId gets stripped away somewhere because of the extra "?" ?

garemoko commented 8 years ago

It's wrong in the console and the LRS. The double question-mark is likely to cause problems, but I'm not even getting that far.

garemoko commented 8 years ago

image

falcon-git commented 8 years ago

How are you printing to console? Since console prints by reference code run after console.log for instance will change what the console.log shows.

I use console.log(JSON.parse(JSON.stringify()))

I have seen that the ADL standard script massages the statements, and sometimes in bad ways, especially if not used correctly

garemoko commented 8 years ago

I was using the code above in this chain H5P.externalDispatcher.on('xAPI', function(event){console.log(event.data.statement);});

I'll take a look using H5P.externalDispatcher.on('xAPI', function(event){console.log(JSON.parse(JSON.stringify(event.data.statement)));});

garemoko commented 8 years ago

Using H5P.externalDispatcher.on('xAPI', function(event){console.log(JSON.parse(JSON.stringify(event.data.statement)));}); the issue remains.