otacke / h5p-game-map

Let your students choose their exercises on a game map.
MIT License
3 stars 6 forks source link

HFP-3825 Add guard against crazy ;-) content types #52

Closed otacke closed 7 months ago

otacke commented 7 months ago

When merged in, will add a guard against content types that may fire xAPI relevant for scoring without being attached to a Game Map exercise popup.

fnoks commented 7 months ago

I was taking a quick look at this one, and wondered why you're not using the this.isAttached instead? And also, I see the instance is deleted when isAttached is set to false, so then I don't understand why CP keeps sending events?

otacke commented 7 months ago

This was merely a hot fix without much thinking. I merely checked what caused the problem and noticed that Course Presentation was sending a "completed" statement when being re-instantiated from previous state.

otacke commented 7 months ago

@fnoks The problem occurred when the user completed the Course Presentation subcontent and left it on the summary slide. That will be stored in CP's state. When CP is re-stored from the previous state, it will jump to the summary slide and send out an xAPI completed statement which it should not when re-creating (prepare for a pull request).

Since GameMap by then will already have the xAPI tracker installed and react on the completed statement while assuming the exercise is attached, the bug appeared. In fact, using '!this.isAttached' is more clear and serves the same purpose. I changed it just now.