Skip to content

Commit

Permalink
reworked scoreLearningElement to exit early if the element is primitive
Browse files Browse the repository at this point in the history
  • Loading branch information
philgei committed Aug 7, 2024
1 parent d5a32f1 commit 2e7e3ad
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@ export default class LearningElementModalController

@bind
async h5pEventCalled(event: any): Promise<void> {
// Skip XAPI events if the element is a primitive h5p
if (this.viewModel.isScoreable.Value === false) {
return;
}

// Skip malformed events.
const hasStatement = event && event.data && event.data.statement;
if (!hasStatement) {
Expand All @@ -68,7 +73,7 @@ export default class LearningElementModalController
statement.context.contextActivities.parent[0] &&
statement.context.contextActivities.parent[0].id;

if (isCompleted && !isChild && this.viewModel.isScoreable.Value) {
if (isCompleted && !isChild) {
const xapiData = event.data.statement as XAPIData;

statement.result.success =
Expand Down

0 comments on commit 2e7e3ad

Please sign in to comment.