Skip to content

Commit

Permalink
Drop overlaps when saving timespans (#4830)
Browse files Browse the repository at this point in the history
* drop overlaps when saving timespans
* changelog
* Update TimeSpanService.scala
* Merge branch 'master' into negative-timespans
  • Loading branch information
fm3 authored Sep 17, 2020
1 parent 85c8b9b commit 127a9b8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
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

0 comments on commit 127a9b8

Please sign in to comment.