Skip to content

Commit 93ff201

Browse files
authored
Merge pull request cfpb#1092 from nickgrippin/q061-fix
Fix Q061
2 parents 801931c + 50ee196 commit 93ff201

File tree

2 files changed

+7
-6
lines changed
  • validation/src

2 files changed

+7
-6
lines changed

validation/src/main/scala/hmda/validation/rules/lar/macro/Q061.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ object Q061 extends AggregateEditCheck[LoanApplicationRegisterSource, LoanApplic
2020

2121
override def apply[as: AS, mat: MAT, ec: EC](lars: LoanApplicationRegisterSource): Future[Result] = {
2222

23-
val firstLienHoepaLoans =
24-
count(lars.filter(lar => lar.hoepaStatus == 1 && lar.actionTakenType == 1 && lar.lienStatus == 1 && lar.rateSpread != "NA")
25-
.filter(lar => lar.rateSpread.toInt >= 5))
23+
val firstLienPropertyLoans =
24+
count(lars.filter(lar => lar.loan.propertyType == 1 && lar.actionTakenType == 1 && lar.lienStatus == 1 && lar.rateSpread != "NA")
25+
.filter(lar => lar.rateSpread.toDouble > 5.0))
2626

2727
val total = count(lars.filter(lar => lar.actionTakenType == 1))
2828

2929
for {
30-
f <- firstLienHoepaLoans
30+
f <- firstLienPropertyLoans
3131
t <- total
3232
} yield {
3333
f.toDouble is lessThanOrEqual(t * multiplier)

validation/src/test/scala/hmda/validation/rules/lar/macro/Q061Spec.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ class Q061Spec extends LessThanOrEqualToPropertyMacroSpec {
1010

1111
override def irrelevantLar(lar: LoanApplicationRegister) = lar.copy(rateSpread = "NA").copy(actionTakenType = 1)
1212
override def relevantLar(lar: LoanApplicationRegister) = {
13-
lar.copy(actionTakenType = 1).copy(hoepaStatus = 1).copy(rateSpread = "5").copy(lienStatus = 1).copy(actionTakenType = 1)
13+
val newLoan = lar.loan.copy(propertyType = 1)
14+
lar.copy(actionTakenType = 1).copy(loan = newLoan).copy(rateSpread = "5.01").copy(lienStatus = 1).copy(actionTakenType = 1)
1415
}
1516

16-
lessThanOrEqualToPropertyTests("first lien hoepa loans", multiplier, relevantLar, irrelevantLar)
17+
lessThanOrEqualToPropertyTests("first lien property type loans", multiplier, relevantLar, irrelevantLar)
1718

1819
override def check: AggregateEditCheck[LoanApplicationRegisterSource, LoanApplicationRegister] = Q061
1920
}

0 commit comments

Comments
 (0)