This project restores the SpeedGrader comments for assignments in Canvas Prod using the Canvas Beta instance. Only the top-level comments are preserved - currently individual question comments are not supported. Also, file links are not preserved.
These instructions will get you a copy of the project up and running on your local machine for use with your own API tokens and Canvas domains.
- Install Node 15 or greater.
- Install Git.
There are two scripts that need to be executed in the following order:
downloadSubmission.js
uploadSubmissionComments.js
downloadSubmission.js
downloads the assignment comments into a JSON file from the Canvas Beta instance.
uploadSubmissionComments.js
uploads the contents of the JSON file from Canvas Beta to Canvas Prod.
- Clone this repo.
git clone https://github.com/ubccapico/restore-speedgrader-comments.git
- Then cd into the repo.
cd restore-speedgrader-comments
- Run the installation script.
npm install
(If you seebabel-node: command not found
, you've missed this step.) - Generate Canvas API tokens from Beta.
- Create a
.env
file.
- To the
.env
file, add the following:CANVAS_API_TOKEN={YOUR BETA API TOKEN}
andCANVAS_API_DOMAIN={YOUR BETA API DOMAIN}
. An exampleCANVAS_API_DOMAIN
ishttps://{school}.beta.instructure.com/api/v1
- Add your course ID and assignment ID to
downloadSubmission.js
. - Run the script:
node downloadSubmission.js
- A
submissions.json
file should be generated in theoutput
folder.
- Edit the
.env
file to point to the production Canvas instance. You will need to regenerate your token from the production site.CANVAS_API_TOKEN={YOUR API TOKEN}
andCANVAS_API_DOMAIN={YOUR API DOMAIN}
. An exampleCANVAS_API_DOMAIN
ishttps://{school}.instructure.com/api/v1
- Add your course ID and assignment ID to
uploadSubmissionComments.js
. Note that the course ID and assignment ID are not necessarily the same as the Beta instance, so double check that these are the correct IDs. - Run the script:
node uploadSubmissionComments.js
- The assignment comments should now show up in SpeedGrader.
- justin0022 - Justin Lee <justin.lee@ubc.ca>
This project is licensed under the GNU General Public License v3.0.