Skip to content

Commit

Permalink
Allow reset-to-base for volume tasks (#4276)
Browse files Browse the repository at this point in the history
* Allow reset-to-base for volume tasks
* changelog
* also log volumetracing id
* Merge branch 'master' into reset-volume-tasks
* Merge refs/heads/master into reset-volume-tasks
  • Loading branch information
fm3 authored and bulldozer-boy[bot] committed Sep 5, 2019
1 parent 800c3a3 commit 60614c0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.md).
[Commits](https://github.com/scalableminds/webknossos/compare/19.09.0...HEAD)

### Added
- Reset to base is now also allowed for volume tasks. [#4276](https://github.com/scalableminds/webknossos/pull/4276)

### Changed

Expand Down
8 changes: 3 additions & 5 deletions app/models/annotation/AnnotationService.scala
Original file line number Diff line number Diff line change
Expand Up @@ -559,12 +559,12 @@ class AnnotationService @Inject()(annotationInformationProvider: AnnotationInfor

def resetToBase(annotation: Annotation)(implicit ctx: DBAccessContext, m: MessagesProvider) = annotation.typ match {
case AnnotationType.Explorational =>
Fox.failure("annotation.revert.skeletonOnly")
case AnnotationType.Task if annotation.skeletonTracingId.isDefined =>
Fox.failure("annotation.revert.tasksOnly")
case AnnotationType.Task =>
for {
task <- taskFor(annotation)
_ = logger.warn(
s"Resetting annotation ${annotation._id} to base, discarding skeleton tracing ${annotation.skeletonTracingId}")
s"Resetting annotation ${annotation._id} to base, discarding skeleton tracing ${annotation.skeletonTracingId} and/or volume tracing ${annotation.volumeTracingId}")
annotationBase <- baseForTask(task._id)
dataSet <- dataSetDAO.findOne(annotationBase._dataSet)(GlobalAccessContext) ?~> "dataSet.nonExistent"
(newSkeletonIdOpt, newVolumeIdOpt) <- tracingFromBase(annotationBase, dataSet)
Expand All @@ -575,8 +575,6 @@ class AnnotationService @Inject()(annotationInformationProvider: AnnotationInfor
_ <- Fox.runOptional(newVolumeIdOpt)(newVolumeId =>
annotationDAO.updateVolumeTracingId(annotation._id, newVolumeId))
} yield ()
case _ if !annotation.skeletonTracingId.isDefined =>
Fox.failure("annotation.revert.skeletonOnly")
}

private def settingsFor(annotation: Annotation)(implicit ctx: DBAccessContext) =
Expand Down
2 changes: 1 addition & 1 deletion conf/messages
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ annotation.edit.failed=Updating the annotation failed
annotation.finish.confirm=Are you sure you want to permanently finish this tracing?
annotation.finish.failed=Finishing the annotation failed
annotation.reset.success=Annotation was successfully reset
annotation.revert.skeletonOnly=Reverting an annotation is only implemented for skeleton tracings of tasks
annotation.revert.tasksOnly=Reverting an annotation is only implemented for tasks
annotation.download.notAllowed=You can’t download this tracing
annotation.notPossible=Couldn’t access annotation
annotation.notActive=The tracing is not active and can’t be finished
Expand Down

0 comments on commit 60614c0

Please sign in to comment.