Paul Vincent:
I’m having trouble executing a Utility Hook from one of my pages (a tabbed table); it only runs if my onFormLoad function is empty, so I’m thinking the issue lies in that script somewhere. It’s mostly just aggregating ‘statuses’:
// Step 1: Map over the units to include full student name and handle 'unitAssessed' value
model.units = model.units.map(obj => {
let newObj = Object.assign({}, obj); // Create a copy of the object
newObj.stuFullName =
${obj.stuFname} ${obj.stuLname}; // Add the new property for full name
// Check 'unitAssessed' value, if empty set to 'Not recorded'
newObj.unitAssessed = obj.unitAssessed || 'Not recorded';
newObj.riskPercentage = Math.round(obj.learnerRisk * 10);
newObj.endDate = moment(obj.unitEnd, 'DD/MM/YYYY');
newObj.monthsRemaining = moment(obj.unitEnd, 'DD/MM/YYYY').diff(moment(), 'months');
return newObj; // Return the new object
});
// Step 2: Filter units based on their status
model.unitsOnprog = _.filter(model.units, unit => unit.unitStatus === 'On Programme');
model.unitsComplete = _.filter(model.units, unit => unit.unitStatus === 'Completed');
model.unitsOutOfTime = _.filter(model.units, unit => unit.unitStatus === 'Out of Time');
model.unitsCancelled = _.filter(model.units, unit =>
unit.unitStatus === 'Cancelled within 14 Days' ||
unit.unitStatus === 'Cancelled before Induction' ||
unit.unitStatus === 'Withdrawn' ||
unit.unitStatus === 'Withdrawn by OCA'
);
// Step 3: Set the initial tab to 1
model.tab = 1;
When the Utility Hook is called (via an html button), first, nothing happens and then the page times out with the message: ERROR 408 Bad Request Timeout of 20000ms exceeded calling create on script. In the helper, there are two onFormRequests triggered, and then an onAppLoad login utility request. Nothing short of deleting the mapping parts of the function allows the correct utility hook to execute. Can anyone point me towards why this is happening?
Edit: Also, I’m getting this in the console, which I’ve not seen before… why might the app be disconnecting?
socket disconnected
site.js:143 BF App (SET_ISONLINE) status: false
socket reconnected
site.js:143 BF App (SET_ISONLINE) status: true