Skip to content

Add test in import code to make sure two overlapping courses aren't imported - #3145

Merged
singingwolfboy merged 2 commits into
openedx:masterfrom
carsongee:cg/course_import_validation
Apr 25, 2014
Merged

Add test in import code to make sure two overlapping courses aren't imported#3145
singingwolfboy merged 2 commits into
openedx:masterfrom
carsongee:cg/course_import_validation

Conversation

@carsongee

Copy link
Copy Markdown
Contributor

We have been having an issue where the course term changes and gets imported via the command line. This completes successfully and creates two courses that have overlapping items in the modulestore. This results in major problems when one course is deleted as it fires errors with findone finding more than one location as well as deleting portions of both courses when one is partially deleted.

This code corrects this by logging an error when the bad import occurs and skipping the import that would cause the bad modulestore state to occur. This is already a condition that is checked for in studio, but this enforces it at the import level so that it can't occur via the management command or other possible xml import entry points either.

FYI to @pdpinch and @ichuang

@sarina not sure on reviewers

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This docstring doesn't really make sense

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The call that breaks if the course overlap happens is 'findone', but I can try and make that clearer

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the quotes would really help! maybe "doesn't import courses that would create a duplicate of the 'findone' course" - that is more explicit.

@sarina

sarina commented Apr 8, 2014

Copy link
Copy Markdown
Contributor

@carsongee

Copy link
Copy Markdown
Contributor Author

For the coverage, I really don't understand what is happening there. I know I am covering all that code (or at least most of it) with this test, but it doesn't show up in the report. I noticed this for the video caption code as well, it just doesn't seem to be picking up coverage in the common folder.

@sarina

sarina commented Apr 8, 2014

Copy link
Copy Markdown
Contributor

Hmm yeah I don't know - maybe @nedbat has an idea?

@nedbat

nedbat commented Apr 9, 2014

Copy link
Copy Markdown
Contributor

This sounds like a decision @wedaly made about how to measure code run by LMS but outside LMS.

@wedaly

wedaly commented Apr 9, 2014

Copy link
Copy Markdown
Contributor

That decision pre-dates me, but there's been an open testeng ticket to fix it for a while: https://edx-wiki.atlassian.net/browse/TE-223

@carsongee

Copy link
Copy Markdown
Contributor Author

I made the suggested changes, and I confirmed that adding common/lib to the source list in cms/.coveragerc shows full line coverage....

@sarina

sarina commented Apr 10, 2014

Copy link
Copy Markdown
Contributor

Awesome, thanks for that additional investigation Carson. 👍 from me.

@singingwolfboy

Copy link
Copy Markdown
Contributor

Looks good to me, as well! Thanks! 👍

singingwolfboy added a commit that referenced this pull request Apr 25, 2014
Add test in import code to make sure two overlapping courses aren't imported
@singingwolfboy
singingwolfboy merged commit 7aa627b into openedx:master Apr 25, 2014
@carsongee
carsongee deleted the cg/course_import_validation branch April 25, 2014 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

open-source-contribution PR author is not from Axim or 2U

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants