Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow reset-to-base for volume tasks #4276

Merged
merged 5 commits into from
Sep 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe update the logger call to also show the discarded volumeId

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