diff --git a/app/classifier/classifier.jsx b/app/classifier/classifier.jsx index 29ca933697..4032c60cc7 100644 --- a/app/classifier/classifier.jsx +++ b/app/classifier/classifier.jsx @@ -141,9 +141,15 @@ class Classifier extends React.Component { }); } - updateAnnotations(annotations) { + updateAnnotations(annotations, fromUserAction = false) { this.setState({ annotations }); this.props.actions.classify.saveAnnotations(annotations); + if (fromUserAction && !this.props.classification?.metadata._inProgress) { + this.props.actions.classify.updateMetadata({ + _inProgress: true, + started_at: new Date().toISOString() + }); + } } updateFeedback(taskId) { @@ -203,12 +209,13 @@ class Classifier extends React.Component { actions.classify.updateMetadata({ subject_dimensions }); } + // handle annotation changes from the subject viewer eg. drawing tasks handleAnnotationChange(classification, newAnnotation) { const { annotations } = this.state; const index = findLastIndex(annotations, annotation => annotation.task === newAnnotation.task); if (index > -1) { annotations[index] = newAnnotation; - this.updateAnnotations(annotations); + this.updateAnnotations(annotations, true); } } diff --git a/app/classifier/task.jsx b/app/classifier/task.jsx index 49e4591302..b8e252fb82 100644 --- a/app/classifier/task.jsx +++ b/app/classifier/task.jsx @@ -16,7 +16,7 @@ class Task extends React.Component { const index = findLastIndex(annotations, annotation => annotation.task === newAnnotation.task); if (index > -1) { annotations[index] = newAnnotation; - this.props.updateAnnotations(annotations); + this.props.updateAnnotations(annotations, true); } } diff --git a/app/redux/ducks/classify.js b/app/redux/ducks/classify.js index 039629a775..d4f0e563e8 100644 --- a/app/redux/ducks/classify.js +++ b/app/redux/ducks/classify.js @@ -51,6 +51,7 @@ function createNewClassification(project, workflow, subject, goldStandardMode, l // Delete the metadata key because we don't want volunteers to see it. subject.update({ 'metadata.intervention': undefined }); const newMetadata = { + _inProgress: false, workflow_version: workflow.version, started_at: (new Date()).toISOString(), user_agent: navigator.userAgent,