Skip to content

Commit 196dc75

Browse files
committed
Invert merging logic: Take existing (from JSON) if possible
1 parent fa504cf commit 196dc75

File tree

1 file changed

+6
-5
lines changed
  • webknossos-datastore/app/com/scalableminds/webknossos/datastore/models/datasource

1 file changed

+6
-5
lines changed

webknossos-datastore/app/com/scalableminds/webknossos/datastore/models/datasource/DataLayer.scala

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -333,14 +333,15 @@ trait DataLayer extends DataLayerLike {
333333
existingAttachmentsOpt match {
334334
case None => Some(newAttachments)
335335
case Some(existingFiles) =>
336-
val segmentIndex = newAttachments.segmentIndex.orElse(existingFiles.segmentIndex)
337-
val connectome = (newAttachments.connectomes ++ existingFiles.connectomes).distinctBy(_.path)
336+
val segmentIndex = existingFiles.segmentIndex.orElse(newAttachments.segmentIndex)
337+
val connectome =
338+
if (existingFiles.connectomes.isEmpty) newAttachments.connectomes else existingFiles.connectomes
338339
val agglomerateFiles =
339-
(newAttachments.agglomerates ++ existingFiles.agglomerates).distinctBy(_.path)
340+
if (existingFiles.agglomerates.isEmpty) newAttachments.agglomerates else existingFiles.agglomerates
340341
val meshFiles =
341-
(newAttachments.meshes ++ existingFiles.meshes).distinctBy(_.path)
342+
if (existingFiles.meshes.isEmpty) newAttachments.meshes else existingFiles.meshes
342343
val cumsumFile =
343-
newAttachments.cumsum.orElse(existingFiles.cumsum)
344+
existingFiles.cumsum.orElse(newAttachments.cumsum)
344345

345346
Some(
346347
DatasetLayerAttachments(

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy