fix: Update only modified annotations

This commit is contained in:
Gustavo Trott 2024-04-16 12:48:51 -03:00
parent a74f9d52ba
commit e68b5c3e34
2 changed files with 4 additions and 4 deletions

View File

@ -83,7 +83,7 @@ class WhiteboardModel extends SystemConfiguration {
} }
} }
PresAnnotationDAO.insertOrUpdateMap(newAnnotationsMap) PresAnnotationDAO.insertOrUpdateMap(annotationsAdded)
val newWb = wb.copy(annotationsMap = newAnnotationsMap) val newWb = wb.copy(annotationsMap = newAnnotationsMap)
saveWhiteboard(newWb) saveWhiteboard(newWb)

View File

@ -64,12 +64,12 @@ object PresAnnotationDAO {
) )
} }
def insertOrUpdateMap(annotations: Map[String, AnnotationVO]) = { def insertOrUpdateMap(annotations: Array[AnnotationVO]) = {
DatabaseConnection.db.run( DatabaseConnection.db.run(
DBIO.sequence( DBIO.sequence(
annotations.map { annotation => annotations.map { annotation =>
prepareInsertOrUpdate(annotation._2) prepareInsertOrUpdate(annotation)
} }.toVector
).transactionally ).transactionally
) )
.onComplete { .onComplete {