Skip to content
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

Merged

Conversation

canstudios-nicolaw
Copy link
Contributor

Fixes #2487

@canstudios-nicolaw canstudios-nicolaw added the S: awaiting-review Completed issues waiting on reviews label Jan 9, 2020
@canstudios-nicolaw canstudios-nicolaw self-assigned this Jan 9, 2020
Copy link
Contributor

@tomgreenfield tomgreenfield left a 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?

plugins/output/adapt/outputHelpers.js Outdated Show resolved Hide resolved
Copy link
Contributor

@tomgreenfield tomgreenfield left a 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';
Copy link
Contributor

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';
};

Copy link
Member

@taylortom taylortom left a 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).

@canstudios-nicolaw
Copy link
Contributor Author

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.

@canstudios-nicolaw canstudios-nicolaw merged commit 4d9ce9b into adaptlearning:release/bugpatch Feb 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S: awaiting-review Completed issues waiting on reviews
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants