diff --git a/common/src/main/scala/hmda/query/repository/ModifiedLarRepository.scala b/common/src/main/scala/hmda/query/repository/ModifiedLarRepository.scala index 3429b3802a..8bf5e92cfc 100644 --- a/common/src/main/scala/hmda/query/repository/ModifiedLarRepository.scala +++ b/common/src/main/scala/hmda/query/repository/ModifiedLarRepository.scala @@ -59,7 +59,9 @@ class ModifiedLarRepository(databaseConfig: DatabaseConfig[JdbcProfile]) { * @return the number of rows removed */ def deleteBySubmissionID(submissionId: SubmissionId): Future[Int] = { - val likeStatement = s"${submissionId.lei}-%" + val period = submissionId.period.year + val lei = submissionId.lei + val likeStatement = s"${lei}-%" db.run( sqlu"""DELETE FROM #${fetchYearTable(submissionId.period.year.toInt)} WHERE submission_id LIKE $likeStatement""" ) diff --git a/modified-lar/src/main/scala/hmda/publication/lar/publication/ModifiedLarPublisher.scala b/modified-lar/src/main/scala/hmda/publication/lar/publication/ModifiedLarPublisher.scala index 7ccdcecfd2..51e45cbc6b 100644 --- a/modified-lar/src/main/scala/hmda/publication/lar/publication/ModifiedLarPublisher.scala +++ b/modified-lar/src/main/scala/hmda/publication/lar/publication/ModifiedLarPublisher.scala @@ -174,19 +174,22 @@ object ModifiedLarPublisher { val graphWithJustS3WithHeader = mlarSource.via(serializeMlar).prepend(mlarHeader).toMat(s3SinkWithHeader)(Keep.right) val finalResult: Future[Unit] = for { - _ <- if (regenerateMlar) - graphWithS3AndPG.run() - else if (isGenerateBothS3Files) { - removeLei - graphWithS3AndPG.run() - } else if (isJustGenerateS3File) - graphWithJustS3NoHeader.run() - else if (isJustGenerateS3FileHeader) - graphWithJustS3WithHeader.run() - else { //everything - removeLei - Future.sequence(List(graphWithJustS3NoHeader.run(), graphWithJustS3WithHeader.run(), graphWithJustPG.run())) - } + _ <- { if (regenerateMlar) { + removeLei + graphWithS3AndPG.run() + } + else if (isGenerateBothS3Files) { + removeLei + graphWithS3AndPG.run() + } else if (isJustGenerateS3File) + graphWithJustS3NoHeader.run() + else if (isJustGenerateS3FileHeader) + graphWithJustS3WithHeader.run() + else { //everything + removeLei + Future.sequence(List(graphWithJustS3NoHeader.run(), graphWithJustS3WithHeader.run(), graphWithJustPG.run())) + } + } } yield () finalResult.onComplete {