adaptlearning / adapt-contrib-xapi

TinCan/xAPI extension for the Adapt Framework
GNU General Public License v3.0
12 stars 27 forks source link

statement attachments are not being processed #115

Closed cahirodoherty-learningpool closed 10 months ago

cahirodoherty-learningpool commented 1 year ago

Subject of the issue/enhancement/features

When statement.attachments are set on xapi:preSendStatement, they aren't getting handled in processAttachments

Your environment

Steps to reproduce

Create a course with xapi extension and a custom plugin that will add an 'attachments' array of objects to the xapi statement. Attachment objects should be of the form outlined here - https://www.npmjs.com/package/xapiwrapper/v/1.11.0#send-statement-with-attachments

Expected behaviour

Attachments will be processed correctly and not rejected by LRS on post

Actual behaviour

XAPI attachment is of incorrect format. POST request is rejected. This is due to never entering the if block https://github.com/adaptlearning/adapt-contrib-xapi/blob/master/js/XAPI.js#L1310-L1312 When attachments is set as null, attachments === undefined is falsey