From 0d1f9b1a1c13fcf8c5eb26554106f0b08ab8f1e3 Mon Sep 17 00:00:00 2001 From: Adam Richie-Halford Date: Mon, 4 Mar 2024 12:04:39 -0800 Subject: [PATCH] FIX: Remove pre-allocation of run ID --- src/firestore/firekit.ts | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/src/firestore/firekit.ts b/src/firestore/firekit.ts index e320ff40..1ff222ac 100644 --- a/src/firestore/firekit.ts +++ b/src/firestore/firekit.ts @@ -898,23 +898,14 @@ export class RoarFirekit { throw new Error(`Could not find assessment with taskId ${taskId} in administration ${administrationId}`); } - // Create the run in the assessment Firestore, record the runId and then - // pass it to the app - const runRef = doc(this.dbRefs!.app.runs); - const runId = runRef.id; - // Check the assignment to see if none of the assessments have been // started yet. If not, start the assignment const assignmentDocRef = doc(this.dbRefs!.admin.assignments, administrationId); const assignmentDocSnap = await transaction.get(assignmentDocRef); if (assignmentDocSnap.exists()) { const assignedAssessments = assignmentDocSnap.data().assessments as IAssignedAssessmentData[]; - const allRunIdsForThisTask = assignedAssessments.find((a) => a.taskId === taskId)?.allRunIds || []; - allRunIdsForThisTask.push(runId); - - const assessmentUpdateData: { startedOn: Date; allRunIds: string[]; runId?: string } = { + const assessmentUpdateData = { startedOn: new Date(), - allRunIds: allRunIdsForThisTask, }; // Append runId to `allRunIds` for this assessment @@ -967,7 +958,6 @@ export class RoarFirekit { assigningOrgs, readOrgs, assignmentId: administrationId, - runId, taskInfo, }); } else {