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

Drop overlaps when saving timespans #4830

Merged
merged 4 commits into from
Sep 17, 2020
Merged
Show file tree
Hide file tree
Changes from 3 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
5 changes: 3 additions & 2 deletions CHANGELOG.released.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released
- Speed up NML import in existing tracings for NMLs with many trees (20,000+). [#4742](https://github.com/scalableminds/webknossos/pull/4742)
- Fixed tree groups when uploading NMLs with multi-component trees. [#4735](https://github.com/scalableminds/webknossos/pull/4735)
- Fixed that invalid number values in slider settings could crash webKnossos. [#4758](https://github.com/scalableminds/webknossos/pull/4758)
- Improved resilience in time tracking, preventing overlapping timespans. [#4830](https://github.com/scalableminds/webknossos/pull/4830)

## [20.08.0](https://github.com/scalableminds/webknossos/releases/tag/20.08.0) - 2020-07-20
[Commits](https://github.com/scalableminds/webknossos/compare/20.07.0...20.08.0)
Expand Down Expand Up @@ -127,13 +128,13 @@ For upgrade instructions, please check the [migration guide](MIGRATIONS.released
- Added support for ID mapping of segmentation layer based on HDF5 agglomerate files. [#4469](https://github.com/scalableminds/webknossos/pull/4469)
- Added option to hide all unmapped segments to segmentation tab. [#4510](https://github.com/scalableminds/webknossos/pull/4510)
- It is now possible to upload volume tracings as a base for tasks. The upload format is similar to the project / task type download format. [#4565](https://github.com/scalableminds/webknossos/pull/4565)
- Added the possibility to share the dataset which is currently viewed (using a private token if the dataset is not public). The option can be found in the dropdown of the navigation bar. [#4543](https://github.com/scalableminds/webknossos/pull/4543)
- Added the possibility to share the dataset which is currently viewed (using a private token if the dataset is not public). The option can be found in the dropdown of the navigation bar. [#4543](https://github.com/scalableminds/webknossos/pull/4543)

### Added
- Users can undo finishing a task when the task was finished via the API, e.g. by a user script. [#4495](https://github.com/scalableminds/webknossos/pull/4495)
- Added the magnification used for determining the segment ids in the segmentation tab to the table of the tab. [#4480](https://github.com/scalableminds/webknossos/pull/4480)
- Added support for ID mapping of segmentation layer based on HDF5 agglomerate files. [#4469](https://github.com/scalableminds/webknossos/pull/4469)
- Added the possibility to share the dataset which is currently viewed (using a private token if the dataset is not public). The option can be found in the dropdown of the navigation bar. [#4543](https://github.com/scalableminds/webknossos/pull/4543)
- Added the possibility to share the dataset which is currently viewed (using a private token if the dataset is not public). The option can be found in the dropdown of the navigation bar. [#4543](https://github.com/scalableminds/webknossos/pull/4543)
- Added option to hide all unmapped segments to segmentation tab. [#4510](https://github.com/scalableminds/webknossos/pull/4510)
- When wK changes datasource-properties.json files of datasets, now it creates a backup log of previous versions. [#4534](https://github.com/scalableminds/webknossos/pull/4534)
- Added a warning to the position input in tracings if the current position is out of bounds. The warning colors the position input orange. [#4544](https://github.com/scalableminds/webknossos/pull/4544)
Expand Down
17 changes: 12 additions & 5 deletions app/models/user/time/TimeSpanService.scala
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,15 @@ class TimeSpanService @Inject()(annotationDAO: AnnotationDAO,
}

def updateTimeSpan(timeSpan: TimeSpan, timestamp: Long) = {
timeSpansToUpdate = (timeSpan, timestamp) :: timeSpansToUpdate

val duration = timestamp - timeSpan.lastUpdate
val updated = timeSpan.addTime(duration, timestamp)
updated
if (duration >= 0) {
timeSpansToUpdate = (timeSpan, timestamp) :: timeSpansToUpdate
timeSpan.addTime(duration, timestamp)
} else {
logger.warn(
s"Not updating previous timespan due to negative duration ${duration} for user ${timeSpan._id}, last timespan id ${timeSpan._id}, this=${this}")
timeSpan
}
}

var current = lastUserActivities
Expand Down Expand Up @@ -155,7 +159,10 @@ class TimeSpanService @Inject()(annotationDAO: AnnotationDAO,

private def isNotInterrupted(current: Long, last: TimeSpan) = {
val duration = current - last.lastUpdate
duration >= 0 && duration < MaxTracingPause
if (duration < 0) {
logger.warn(s"Negative timespan duration to previous entry.")
}
duration < MaxTracingPause
}

private def belongsToSameTracing(last: TimeSpan, annotation: Option[Annotation]) =
Expand Down