-
Notifications
You must be signed in to change notification settings - Fork 290
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move course validation to back-end for efficiency #2489
Move course validation to back-end for efficiency #2489
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Validation is functioning for me – I've been testing by creating a new course and then deleting the page, is this sufficient?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When attempting to preview a course with no components:
application.js:630 TypeError: Cannot read property '0' of undefined
at D:\adapt_authoring\plugins\output\adapt\outputHelpers.js:311:17
at Array.forEach (<anonymous>)
at iterateThroughChildren (D:\adapt_authoring\plugins\output\adapt\outputHelpers.js:308:11)
at Object.validateCourse (D:\adapt_authoring\plugins\output\adapt\outputHelpers.js:299:13)
at D:\adapt_authoring\plugins\output\adapt\publish.js:64:21
at nextTask (D:\adapt_authoring\node_modules\async\dist\async.js:4578:27)
at next (D:\adapt_authoring\node_modules\async\dist\async.js:4586:13)
at D:\adapt_authoring\node_modules\async\dist\async.js:325:20
at D:\adapt_authoring\plugins\output\adapt\publish.js:59:9
at wrapper (D:\adapt_authoring\node_modules\async\dist\async.js:272:20)
at D:\adapt_authoring\node_modules\async\dist\async.js:1639:19
at wrapper (D:\adapt_authoring\node_modules\async\dist\async.js:272:20)
at replenish (D:\adapt_authoring\node_modules\async\dist\async.js:439:29)
at iterateeCallback (D:\adapt_authoring\node_modules\async\dist\async.js:428:21)
at D:\adapt_authoring\node_modules\async\dist\async.js:325:20
at D:\adapt_authoring\node_modules\async\dist\async.js:1637:17
at storeOutput (D:\adapt_authoring\lib\outputmanager.js:132:3)
at D:\adapt_authoring\node_modules\async\dist\async.js:53:47
at D:\adapt_authoring\lib\outputmanager.js:188:14
at D:\adapt_authoring\node_modules\mongoose\lib\model.js:4590:16
at D:\adapt_authoring\node_modules\mongoose\lib\utils.js:264:16
at D:\adapt_authoring\node_modules\mongoose\lib\query.js:4326:11
at D:\adapt_authoring\node_modules\kareem\index.js:135:16
at processTicksAndRejections (internal/process/task_queues.js:75:11)
type: parentType[0].toUpperCase() + parentType.slice(1), | ||
title: parent.title, | ||
childType: childType | ||
}) + '\n'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the new code is identical to lines 327–331, suggest storing in a variable that can be called:
const appendError = () => {
errors += app.polyglot.t('app.doesnotcontain', {
type: parentType[0].toUpperCase() + parentType.slice(1),
title: parent.title,
childType: childType
}) + '\n';
};
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works for me 👍
Only suggestion I'd make is moving the error info out of 'debug info', as it feels like it's something you'd want to know by default (rather than hiding it).
I'm not going to get a chance to work on this for a little while. I think it's a good suggestion but it would be worth releasing this as-is for now. |
Fixes #2487