mirror of
https://github.com/bitcoin-s/bitcoin-s.git
synced 2025-01-19 05:43:51 +01:00
Removed extraneous findAll call from CRUD.updateAll (#3154)
* Removed extraneous findAll call from CRUD.updateAll * Made update tests deal with unchanged element
This commit is contained in:
parent
880c8898da
commit
17d1145504
@ -90,9 +90,15 @@ abstract class CRUD[T, PrimaryKeyType](implicit
|
||||
} else {
|
||||
val actions = ts.map(t => find(t).update(t))
|
||||
for {
|
||||
_ <- safeDatabase.runVec(DBIO.sequence(actions).transactionally)
|
||||
result <- safeDatabase.runVec(findAll(ts).result)
|
||||
} yield result
|
||||
numUpdated <- safeDatabase.runVec(
|
||||
DBIO.sequence(actions).transactionally)
|
||||
tsUpdated <- {
|
||||
if (numUpdated.sum == ts.length) Future.successful(ts)
|
||||
else
|
||||
Future.failed(new RuntimeException(
|
||||
s"Unexpected number of updates completed ${numUpdated.sum} of ${ts.length}"))
|
||||
}
|
||||
} yield tsUpdated
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,8 @@ sealed trait TestDAOFixture
|
||||
|
||||
val updatedDb: TestDb = testDb.copy(data = hex"0000")
|
||||
|
||||
val updatedDbs: Vector[TestDb] = testDbs.map(_.copy(data = hex"0000"))
|
||||
val updatedDbs: Vector[TestDb] =
|
||||
testDbs.init.map(_.copy(data = hex"0000")).:+(testDbs.last)
|
||||
|
||||
def testCreate(testDAO: TestDAO): Future[Boolean] = {
|
||||
for {
|
||||
|
Loading…
Reference in New Issue
Block a user