From 9d9cc4a4a732e6acce0da96c0685f8aae1c7718f Mon Sep 17 00:00:00 2001 From: Jim O'Donnell Date: Thu, 7 Nov 2024 09:43:38 +0000 Subject: [PATCH] Update startedAt when the first annotation is made --- packages/lib-classifier/src/store/ClassificationStore.js | 4 ++++ packages/lib-classifier/src/store/ClassificationStore.spec.js | 1 - 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/lib-classifier/src/store/ClassificationStore.js b/packages/lib-classifier/src/store/ClassificationStore.js index bcf0ceeee8..705d4c12c9 100644 --- a/packages/lib-classifier/src/store/ClassificationStore.js +++ b/packages/lib-classifier/src/store/ClassificationStore.js @@ -88,6 +88,10 @@ const ClassificationStore = types if (validClassificationReference) { const classification = self.active + if (classification.annotations.size === 0) { + // update startedAt if we're starting a new classification + classification.metadata.startedAt = (new Date()).toISOString() + } if (classification) { return classification.addAnnotation(task, annotationValue) } diff --git a/packages/lib-classifier/src/store/ClassificationStore.spec.js b/packages/lib-classifier/src/store/ClassificationStore.spec.js index fdd77dea43..f9a8bd2c0c 100644 --- a/packages/lib-classifier/src/store/ClassificationStore.spec.js +++ b/packages/lib-classifier/src/store/ClassificationStore.spec.js @@ -128,7 +128,6 @@ describe('Model > ClassificationStore', function () { classifications = rootStore.classifications classifications.setOnComplete(snapshot => { - console.log(snapshot) submittedClassification = snapshot }) const taskSnapshot = Object.assign({}, singleChoiceTaskSnapshot, { taskKey: singleChoiceAnnotationSnapshot.task })