Skip to content

Commit

Permalink
Merge pull request #1195 from nationalarchives/use-correct-join-for-s…
Browse files Browse the repository at this point in the history
…eries

Use correct join
  • Loading branch information
TomJKing authored Jun 5, 2024
2 parents 0cf7229 + 11c4781 commit 378f181
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class MetadataUtils(config: Config) {
sql""" SELECT b."Name", "ConsignmentReference", COALESCE(s."Name", '')
FROM "Consignment" c
JOIN "Body" b ON b."BodyId" = c."BodyId"
LEFT JOIN "Series" s ON b."BodyId" = s."BodyId"
LEFT JOIN "Series" s ON c."SeriesId" = s."SeriesId"
WHERE "ConsignmentId" = CAST(${consignmentId.toString} AS UUID) """
.query[(String, String, String)]
.unique
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@ class TestUtils extends AnyFlatSpec with TestContainerForAll with BeforeAndAfter
_ <- sql"""INSERT INTO "Series" ("SeriesId", "BodyId", "Name", "Code") VALUES (CAST($seriesId AS UUID), CAST($bodyId AS UUID), 'Test', 'TST') """.update.run.transact(
transactor
)
_ <- sql""" INSERT INTO "Consignment" ("ConsignmentId", "UserId", "Datetime", "ConsignmentSequence", "ConsignmentReference", "ConsignmentType", "BodyId")
VALUES (CAST($consignmentId AS UUID), CAST($userId AS UUID), CAST($dateTime AS TIMESTAMP), $sequence, $consignmentRef, 'standard', CAST($bodyId AS UUID)) """.update.run
_ <- sql""" INSERT INTO "Consignment" ("ConsignmentId", "UserId", "Datetime", "ConsignmentSequence", "ConsignmentReference", "ConsignmentType", "BodyId", "SeriesId")
VALUES (CAST($consignmentId AS UUID), CAST($userId AS UUID), CAST($dateTime AS TIMESTAMP), $sequence, $consignmentRef, 'standard', CAST($bodyId AS UUID), CAST($seriesId AS UUID)) """.update.run
.transact(transactor)
_ <- fileIds.map { fileId =>
sql""" INSERT INTO "File" ("FileId", "ConsignmentId", "UserId", "Datetime")
Expand Down

0 comments on commit 378f181

Please sign in to comment.