From 8391006b4ddba552edc0e490f15a15b529dd46e3 Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 21 Nov 2019 19:59:05 -0500 Subject: [PATCH 1/2] Add support for assignments with no tool_id. --- functions/src/api/move-student-work.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/functions/src/api/move-student-work.ts b/functions/src/api/move-student-work.ts index 89831a84..73c03ddb 100644 --- a/functions/src/api/move-student-work.ts +++ b/functions/src/api/move-student-work.ts @@ -4,6 +4,7 @@ import { IPortalMoveStudentsConfig, IPortalMoveStudentsAssignment } from "./help // This matches the make_source_key method in LARA's report_service.rb const makeSourceKey = (toolId: string) => { + return toolId.replace(/http[|s]?:\/\/([^\/]+)/, "$1") } @@ -15,7 +16,9 @@ const processAnswer = (answerDoc: any, data: any) => { // this returns a promise that resolves // once all of the answer documents of the user have been updated const processAssignment = (assignment: IPortalMoveStudentsAssignment, config: IPortalMoveStudentsConfig) => { - + if (!assignment.tool_id) { + return Promise.resolve(null) + } const sourceKey = makeSourceKey(assignment.tool_id) const data = { class_info_url: config.new_class_info_url, From 3bf5b1e63738a84e7db43f38b920007384163b5f Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 21 Nov 2019 20:04:42 -0500 Subject: [PATCH 2/2] Remove accidental line break. --- functions/src/api/move-student-work.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/functions/src/api/move-student-work.ts b/functions/src/api/move-student-work.ts index 73c03ddb..ec117a99 100644 --- a/functions/src/api/move-student-work.ts +++ b/functions/src/api/move-student-work.ts @@ -4,7 +4,6 @@ import { IPortalMoveStudentsConfig, IPortalMoveStudentsAssignment } from "./help // This matches the make_source_key method in LARA's report_service.rb const makeSourceKey = (toolId: string) => { - return toolId.replace(/http[|s]?:\/\/([^\/]+)/, "$1") }