Side-effects of Removing and then Re-adding the same course

I was wondering, let’s say a several students/learners are enrolled in a course that has been published, yet you need to delete that course for some reason and then reimport it (with the same name, org, term, etc), what are the side-effects of that action?

It seems that, the history of the student’s interaction with the course:
select * from courseware_studentmodule;
does not get wiped as well as, course enrollment info like:
select * from student_courseenrollment;

And it looks like the progress is saved, etc… so I’m thinking as long as when the course is reimported it’s reimported with the same course information as the previous one that got deleted, it should be fine since the course_id stays in the SQL database, even though the module store had content removed:

Preparing to delete course course-v1:DEMO+D101+2020_11_T2 from module store....
Are you sure you want to delete course course-v1:DEMO+D101+2020_11_T2? [y/N] y
Are you sure? This action cannot be undone! [y/N] y
2020-11-02 17:35:54,701 INFO 1 [xmodule.modulestore.split_mongo.split] [user None] split.py:2754 - deleting course from split-mongo: course-v1:DEMO+D101+2020_11_T2
2020-11-02 17:35:54,705 WARNING 1 [py.warnings] [user None] collection.py:3227 - /openedx/venv/lib/python3.5/site-packages/mongodb_proxy.py:117: DeprecationWarning: remove is deprecated. Use delete_one or delete_many instead.
  return self.proxied_object(*args, **kwargs)
2020-11-02 17:35:54,747 INFO 1 [elasticsearch] [user None] base.py:63 - HEAD http://elasticsearch:9200/courseware_index [status:200 request:0.003s]
2020-11-02 17:35:54,752 INFO 1 [elasticsearch] [user None] base.py:63 - GET http://elasticsearch:9200/courseware_index/course_info/_search [status:200 request:0.004s]
2020-11-02 17:35:54,757 INFO 1 [elasticsearch] [user None] base.py:63 - POST http://elasticsearch:9200/_bulk [status:200 request:0.003s]
2020-11-02 17:35:54,761 INFO 1 [openedx.core.djangoapps.content.block_structure.store] [user None] store.py:117 - BlockStructure: Deleted from cache and store; block-v1:DEMO+D101+2020_11_T2+type@course+block@course.
2020-11-02 17:35:54,763 INFO 1 [xmodule.modulestore.django] [user None] django.py:198 - Sent course_deleted signal to <function _listen_for_course_delete at 0x7fcd93c98a60> with kwargs {'course_key': CourseLocator('DEMO', 'D101', '2020_11_T2', None, None)}. Response was: None
2020-11-02 17:35:54,765 INFO 1 [xmodule.modulestore.django] [user None] django.py:198 - Sent course_deleted signal to <function _delete_block_structure_on_course_delete at 0x7fcd93ca3730> with kwargs {'course_key': CourseLocator('DEMO', 'D101', '2020_11_T2', None, None)}. Response was: None
removing User permissions from course....
Deleted course course-v1:DEMO+D101+2020_11_T2

Thanks for any and all input :slight_smile: !

1 Like

Great question @irishgordo!

And you’re correct: not much happens when you delete a course.

  • Course is removed from the course index list, but the course content itself remains in mongo.
  • Course staff and instructor role associations are removed (that’s the “removing User permissions from course” step in your output logs).
    These will need to be recreated if you want the same course staff on the re-imported course.
  • Course Overview data is deleted.
    This is visible in the Django Admin under /admin/course_overviews/courseoverview/, and will be re-created if you re-import.

But everything else remains intact, though disconnected from the Course Overview noted above. Course enrollments, persistent grades, answers to problems and other links to the course overview, all the MySQL data. Even the course wiki and discussion posts remain intact.

2 Likes

@jill thanks so much for your response!
I appreciate the insight :slight_smile: