Hi devs,
We are currently experiencing an issue in tracker capture (v26) registration process. When we do a new registration, it actually does necessary api calls to persist the registration, but front-end web application stops execution(doesn’t show feedback) due to a javascript exception which throws due to reading an object as an array.
Issue it at line line 1903 services.js branch v26,
1902 : var periods = getEventDuePeriod(null, stage, enrollment);
1903 : newEvent.dueDate = DateUtils.formatFromUserToApi(periods[0].endDate);
However, at line 1826 of services.js in branch v26,
it does following transformation after doing same method call(getEventDuePeriod) which returns an object,
var prds = getEventDuePeriod(eventsPerStage, programStage, enrollment);
var periods = prds && prds.availablePeriods && prds.availablePeriods.length ? prds.availablePeriods : [];
And does periods.length>0 check before accessing periods[0]. So I believe, same should be done at 1903.
I think this issue was not there in v25, since getEventDuePeriod() was actually returning an array.
Please find a screenshot taken during the javascript debug attached with this email for further clarification.
Kindly let us know if this is an issue in code(services.js), or if this is an issue in our setup. If you can confirm this is a bug, I can send a PR with the fix.
Thanks & Regards,
Chathura
Selection_016.bmp (705 KB)