Skip to content

fix importing bug (STUD-1599) - #3626

Merged
adampalay merged 1 commit into
masterfrom
adam/fix-import-bug
May 12, 2014
Merged

fix importing bug (STUD-1599)#3626
adampalay merged 1 commit into
masterfrom
adam/fix-import-bug

Conversation

@adampalay

Copy link
Copy Markdown
Contributor

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.

I think instead of adding this extra condition you can just make course_prefix (#L179) to be:
course_prefix = u'{0.org}/{0.course}/'.format(course_location) a slash at the end of course to match the condition.

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.

Also since this can only happen when a course is imported through management command as in case of import through studio the course_id remains same, so we can move (#L179 - #L205) inside the condition
if target_location_namespace is None: since target_location_namespace is None in case of management command.

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.

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.

@adampalay You are right but I was talking about the extra validation of course_id (#L179 - #L205), which I guess will be required for only courses imported through management command.

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.

why?

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.

For courses imported by studio have target_location (course_id) same after import. But if you import through management command then import view creates a new course with target_location same as the importing course.

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.

hmmm
on prod we're seeing this with studio. I can't reproduce it locally though

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.

@adampalay I have added reproduction steps on jira ticket.

@zubair-arbi

Copy link
Copy Markdown
Contributor

Suggestion: we can call unique course_id validation a bit earlier when the course is about to get imported (perhaps at https://github.com/edx/edx-platform/blob/master/common/lib/xmodule/xmodule/modulestore/xml.py#L524 when course_id is calculated for imported course). This way we can give response in case of unique course key violation without importing all content.

@zubair-arbi

Copy link
Copy Markdown
Contributor

This looks good to me. 👍

@adampalay

Copy link
Copy Markdown
Contributor Author

@cahrens , may you please take a look too?

@cahrens

cahrens commented May 9, 2014

Copy link
Copy Markdown

I am out. Please ask Nimisha or Don.

@adampalay

Copy link
Copy Markdown
Contributor Author

Ok, @nasthagiri or @dmitchell ?

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.

replace this line w/

     course_org_lower = course_location.org.lower()
     course_cat_lower = course_location.course.lower()  # cat as abbreviation for catalog, not sure if best name

@adampalay

Copy link
Copy Markdown
Contributor Author

@dmitchell another round?

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.

Ah, I've been on opaque_keys so long that I forgot that course.id is not an object! For now, use course.location.course instead of course.number. If org works as you have it, fine.

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.

Got it. I'll change course.org to course.location.org for consistency too

@dmitchell

Copy link
Copy Markdown
Contributor

👍 if you update the accessors to be slightly closer to opaque keys.

add target_location_namespace check
adampalay added a commit that referenced this pull request May 12, 2014
@adampalay
adampalay merged commit 4ecf411 into master May 12, 2014
@adampalay
adampalay deleted the adam/fix-import-bug branch May 12, 2014 20:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants