canvas-grade-uploader
Advanced tools
Comparing version 1.0.3 to 1.1.0
@@ -56,3 +56,3 @@ #! /usr/bin/env node | ||
parser.addArgument( | ||
[ '-uid', '--user-id-format' ], | ||
[ '-sid', '--student-id-format' ], | ||
{ | ||
@@ -59,0 +59,0 @@ // TODO: Un-Berkeley-ify this option |
{ | ||
"name": "canvas-grade-uploader", | ||
"version": "1.0.3", | ||
"version": "1.1.0", | ||
"description": "Upload a CSV file of grades to Canvas", | ||
@@ -5,0 +5,0 @@ "main": "./uploader.js", |
@@ -43,2 +43,3 @@ # Canvas Grade Uploader | ||
For example: | ||
``` | ||
@@ -73,3 +74,3 @@ https://bcourses.berkeley.edu/courses/1268501/assignments/7148451 | ||
* URL, `-u` defaults to: `https://bcourses.berkeley.edu` | ||
* User ID format, `-uid` defaults to: `sis_user_id`. This parameter controls how Canvas interprets user IDs. See [this][sid-id]. | ||
* User ID format, `-sid` defaults to: `sis_user_id`. This parameter controls how Canvas interprets user IDs. See [this][sid-id]. | ||
@@ -76,0 +77,0 @@ (In the future, I'd consider supporting some means of having user-default parameters, so please submit a PR if you'd like!) |
@@ -20,2 +20,5 @@ // Upload a CSV of Grades to Canvas | ||
// Prevent newlines from turning to Canvas Errors | ||
str = str.trim(); | ||
// Options: http://papaparse.com/docs#config | ||
@@ -43,4 +46,4 @@ csvObj = Papa.parse(str, { | ||
result.names[`${opts['user_id_format']}:${sid}`] = name; | ||
result.scores[`${opts['user_id_format']}:${sid}`] = grade; | ||
result.names[`${opts['student_id_format']}:${sid}`] = name; | ||
result.scores[`${opts['student_id_format']}:${sid}`] = grade; | ||
}); | ||
@@ -91,5 +94,8 @@ | ||
course.post(url, {}, form, function(error, resp, body) { | ||
if (body && body.url) { | ||
cb(`URL ${body.url}`); | ||
} | ||
if (error || !body || body.errors) { | ||
cb('Uh, oh! An error occurred'); | ||
cb(error); | ||
cb(error || ''); | ||
cb(body.errors || 'No error message...'); | ||
@@ -99,3 +105,2 @@ return; | ||
cb('Course Updates Posted'); | ||
cb(`URL ${body.url}`); | ||
@@ -102,0 +107,0 @@ monitorProgress(course, body.id, cb); |
Sorry, the diff of this file is not supported yet
17049
10
195
101