Skip to content

Commit

Permalink
Remove old quarterly lei function.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredb96 committed Oct 30, 2024
1 parent 64fd69c commit fa870aa
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 23 deletions.
34 changes: 15 additions & 19 deletions hmda-analytics/src/main/scala/hmda/analytics/HmdaAnalyticsApp.scala
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,6 @@ object HmdaAnalyticsApp extends App with TransmittalSheetComponent with LarCompo

def deleteByLei(lei: String): Future[Int] = transmittalSheet.deleteByLei(lei)

def deleteByLeiAndQuarter(lei: String): Future[Int] = transmittalSheet.deleteByLeiAndQuarter(lei)

def updateByLei(ts: TransmittalSheetEntity): Future[Int] = transmittalSheet.updateByLei(ts)

def count(): Future[Int] = transmittalSheet.count()
Expand Down Expand Up @@ -146,8 +144,6 @@ object HmdaAnalyticsApp extends App with TransmittalSheetComponent with LarCompo

// for 2018
def insert(le: LarEntity2018): Future[Int] = larRepo.insert(le)

def deletebyLeiAndQuarter(lei: String): Future[Int] = larRepo.deletebyLeiAndQuarter(lei)

def deleteByLei(lei: String): Future[Int] = larRepo.deleteByLei(lei)

Expand Down Expand Up @@ -334,25 +330,25 @@ object HmdaAnalyticsApp extends App with TransmittalSheetComponent with LarCompo
delete <- submissionId.period match {
case Period(2018, None) => YearlyLarRepositoryWrapper("2018").getLarRepository.deleteByLei(lar.larIdentifier.LEI)
case Period(2019, None) => YearlyLarRepositoryWrapper("2019").getLarRepository.deleteByLei(lar.larIdentifier.LEI)
case Period(2020, Some("Q1")) =>QuarterlyLarRepositoryWrapper("2020", "Q1").getLarRepository.deletebyLeiAndQuarter(lar.larIdentifier.LEI)
case Period(2020, Some("Q2")) => QuarterlyLarRepositoryWrapper("2020", "Q2").getLarRepository.deletebyLeiAndQuarter(lar.larIdentifier.LEI)
case Period(2020, Some("Q3")) => QuarterlyLarRepositoryWrapper("2020", "Q3").getLarRepository.deletebyLeiAndQuarter(lar.larIdentifier.LEI)
case Period(2020, Some("Q1")) =>QuarterlyLarRepositoryWrapper("2020", "Q1").getLarRepository.deleteByLei(lar.larIdentifier.LEI)
case Period(2020, Some("Q2")) => QuarterlyLarRepositoryWrapper("2020", "Q2").getLarRepository.deleteByLei(lar.larIdentifier.LEI)
case Period(2020, Some("Q3")) => QuarterlyLarRepositoryWrapper("2020", "Q3").getLarRepository.deleteByLei(lar.larIdentifier.LEI)
case Period(2020, None) => YearlyLarRepositoryWrapper("2020").getLarRepository.deleteByLei(lar.larIdentifier.LEI)
case Period(2021, None) =>YearlyLarRepositoryWrapper("2021").getLarRepository.deleteByLei(lar.larIdentifier.LEI)
case Period(2022, None) =>YearlyLarRepositoryWrapper("2022").getLarRepository.deleteByLei(lar.larIdentifier.LEI)
case Period(2023, None) =>YearlyLarRepositoryWrapper("2023").getLarRepository.deleteByLei(lar.larIdentifier.LEI)
case Period(2021, Some("Q1")) => QuarterlyLarRepositoryWrapper("2021", "Q1").getLarRepository.deletebyLeiAndQuarter(lar.larIdentifier.LEI)
case Period(2021, Some("Q2")) => QuarterlyLarRepositoryWrapper("2021", "Q2").getLarRepository.deletebyLeiAndQuarter(lar.larIdentifier.LEI)
case Period(2021, Some("Q3")) => QuarterlyLarRepositoryWrapper("2021", "Q3").getLarRepository.deletebyLeiAndQuarter(lar.larIdentifier.LEI)
case Period(2022, Some("Q1")) => QuarterlyLarRepositoryWrapper("2022", "Q1").getLarRepository.deletebyLeiAndQuarter(lar.larIdentifier.LEI)
case Period(2022, Some("Q2")) => QuarterlyLarRepositoryWrapper("2022", "Q2").getLarRepository.deletebyLeiAndQuarter(lar.larIdentifier.LEI)
case Period(2022, Some("Q3")) => QuarterlyLarRepositoryWrapper("2022", "Q3").getLarRepository.deletebyLeiAndQuarter(lar.larIdentifier.LEI)
case Period(2023, Some("Q1")) => QuarterlyLarRepositoryWrapper("2023", "Q1").getLarRepository.deletebyLeiAndQuarter(lar.larIdentifier.LEI)
case Period(2023, Some("Q2")) => QuarterlyLarRepositoryWrapper("2023", "Q2").getLarRepository.deletebyLeiAndQuarter(lar.larIdentifier.LEI)
case Period(2023, Some("Q3")) => QuarterlyLarRepositoryWrapper("2023", "Q3").getLarRepository.deletebyLeiAndQuarter(lar.larIdentifier.LEI)
case Period(2024, Some("Q1")) => QuarterlyLarRepositoryWrapper("2024", "Q1").getLarRepository.deletebyLeiAndQuarter(lar.larIdentifier.LEI)
case Period(2024, Some("Q2")) => QuarterlyLarRepositoryWrapper("2024", "Q2").getLarRepository.deletebyLeiAndQuarter(lar.larIdentifier.LEI)
case Period(2024, Some("Q3")) => QuarterlyLarRepositoryWrapper("2024", "Q3").getLarRepository.deletebyLeiAndQuarter(lar.larIdentifier.LEI)
case Period(2021, Some("Q1")) => QuarterlyLarRepositoryWrapper("2021", "Q1").getLarRepository.deleteByLei(lar.larIdentifier.LEI)
case Period(2021, Some("Q2")) => QuarterlyLarRepositoryWrapper("2021", "Q2").getLarRepository.deleteByLei(lar.larIdentifier.LEI)
case Period(2021, Some("Q3")) => QuarterlyLarRepositoryWrapper("2021", "Q3").getLarRepository.deleteByLei(lar.larIdentifier.LEI)
case Period(2022, Some("Q1")) => QuarterlyLarRepositoryWrapper("2022", "Q1").getLarRepository.deleteByLei(lar.larIdentifier.LEI)
case Period(2022, Some("Q2")) => QuarterlyLarRepositoryWrapper("2022", "Q2").getLarRepository.deleteByLei(lar.larIdentifier.LEI)
case Period(2022, Some("Q3")) => QuarterlyLarRepositoryWrapper("2022", "Q3").getLarRepository.deleteByLei(lar.larIdentifier.LEI)
case Period(2023, Some("Q1")) => QuarterlyLarRepositoryWrapper("2023", "Q1").getLarRepository.deleteByLei(lar.larIdentifier.LEI)
case Period(2023, Some("Q2")) => QuarterlyLarRepositoryWrapper("2023", "Q2").getLarRepository.deleteByLei(lar.larIdentifier.LEI)
case Period(2023, Some("Q3")) => QuarterlyLarRepositoryWrapper("2023", "Q3").getLarRepository.deleteByLei(lar.larIdentifier.LEI)
case Period(2024, Some("Q1")) => QuarterlyLarRepositoryWrapper("2024", "Q1").getLarRepository.deleteByLei(lar.larIdentifier.LEI)
case Period(2024, Some("Q2")) => QuarterlyLarRepositoryWrapper("2024", "Q2").getLarRepository.deleteByLei(lar.larIdentifier.LEI)
case Period(2024, Some("Q3")) => QuarterlyLarRepositoryWrapper("2024", "Q3").getLarRepository.deleteByLei(lar.larIdentifier.LEI)
case _ => {
log.error(s"Unable to discern period from $submissionId to delete LAR rows.")
throw new IllegalArgumentException(s"Unable to discern period from $submissionId to delete LAR rows.")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,6 @@ trait TransmittalSheetComponent {
def deleteByLei(lei: String): Future[Int] =
db.run(table.filter(_.lei.toUpperCase === lei.toUpperCase).delete)

def deleteByLeiAndQuarter(lei: String): Future[Int] =
db.run(table.filter(x => x.lei.toUpperCase === lei.toUpperCase && x.isQuarterly === true).delete)

def updateByLei(ts: TransmittalSheetEntity): Future[Int] =
db.run(table.insertOrUpdate(ts))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ class TransmittalSheetComponentSpec extends TransmittalSheetAsyncSetup {
_ = sheets.size mustBe 1
rowsUpdated <- transmittalSheetRepository.updateByLei(quarterlyTs.copy(name = quarterlyTs.name + "-updated"))
_ = rowsUpdated mustBe 1
rowsDeleted <- transmittalSheetRepository.deleteByLeiAndQuarter(quarterlyTs.lei)
rowsDeleted <- transmittalSheetRepository.deleteByLei(quarterlyTs.lei)
} yield rowsDeleted mustBe 1
}
}
Expand Down

0 comments on commit fa870aa

Please sign in to comment.