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
Add rake tasks to un/archive a course #6342
Open
mishaschwartz
wants to merge
18
commits into
MarkUsProject:master
Choose a base branch
from
mishaschwartz:archive-course
base: master
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mishaschwartz
force-pushed
the
archive-course
branch
from
November 17, 2022 17:17
c70817c
to
4b59040
Compare
mishaschwartz
force-pushed
the
archive-course
branch
2 times, most recently
from
December 7, 2022 17:52
e14a95f
to
a29c17d
Compare
mishaschwartz
force-pushed
the
archive-course
branch
from
December 19, 2022 20:32
a29c17d
to
e5901ff
Compare
mishaschwartz
force-pushed
the
archive-course
branch
2 times, most recently
from
January 3, 2023 21:07
78e36fc
to
8000bc2
Compare
mishaschwartz
force-pushed
the
archive-course
branch
from
January 13, 2023 16:14
6e9cb13
to
cf7d0a5
Compare
pretendWhale
approved these changes
Jan 13, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation and Context
This PR adds several rake tasks to archive, unarchive, and delete a course and all its content. The relevant tasks are:
The following rake tasks were also moved:
The archive task works by copying the database content for all records associated with a course to csv files (one per table) and all files on disk associated with the course as is. These files are saved as a tar.gz archive on disk.
The remove task works by deleting the records associated with the course from the database and deleting all files on disk associated with the course.
The unarchive task works by copying the content of the csv files to a temporary database, running any pending migrations on the data and then copying the data from that database into the database used by the current MarkUs instance. Then the archived files are copied back to the expected location on disk. In order to ensure that there are no conflicts between identifiers the unarchive task does the following:
IDENTIFIER
constant defined on the class. This is done because ids may have changed since the course was archived. For example, a role may refer to a user and the correct user is identified by inspecting theuser_name
column.In order for archiving an entire course to work, there were a few adjustments that needed to be made to the source code as well. These include:
assignment_properties.autotest_settings
field as a json string. This acted as a foreign key reference to the test_groups that should be displayed and in which order. Updating this field within the json string when the test group ids changed during unarchiving was going to be very error prone so I updated this so that the order is stored in the test_groups table instead. If a test group has a non-null tester_index then it is displayed on the Automated Testing page in ascending order as determined by the tester_index value.Settings.file_storage
values. In order to do this, I moved the file storage locations out of constants and into methods that will be executed dynamically.:course
. Two new models (LtiLineItem and LtiService) needed to have ahas_one :course
association added. Note that this is also required if we ever create a controller for either of these models since we use this same method to verify that the course in the url is correct.Your Changes
Description:
Type of change (select all that apply):
Testing
Questions and Comments (if applicable)
Checklist
Pull request to make documentation changes (if applicable)