Skip to content

Commit

Permalink
remove file from folders if we are moving it into the same dataset
Browse files Browse the repository at this point in the history
  • Loading branch information
tcnichol committed Mar 20, 2024
1 parent f28c203 commit 1de29c2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions app/api/Datasets.scala
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,15 @@ class Datasets @Inject()(
}
Logger.debug("----- Adding file to dataset completed")
} else {
val foldersContainingFile = folders.findByFileId(file.id).sortBy(_.name)
Logger.debug("File was already in dataset.")
val foldersContainingFile = folders.findByFileId(file.id).sortBy(_.name)
Logger.debug("Remove file from folders in dataset")
folders.get(foldersContainingFile).foreach(folder => {
if (folder.parentDatasetId == dsId){
folders.removeFile(folder.id, fileId)
}
})
}
}

Expand Down

0 comments on commit 1de29c2

Please sign in to comment.