Skip to content

Conversation

JakeReid2020
Copy link
Contributor

No description provided.

@platops-pr-bot
Copy link

@platops-pr-bot
Copy link

Copy link
Contributor

@anna-shen-hmrc anna-shen-hmrc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add tests for NGRMonthYear, RaldRepo, InputDateForMonthYear. Missing creating InterimRentSetByTheCourt model also missing to add to RaldUserAnswers. Please address PR bot.


import play.api.libs.json.{Json, OFormat}

case class InterimRentSetByTheCourt(amount: String,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please add spec for this?

regexp(amountRegex.pattern(), howMuchFormatError)
)
)
.transform[BigDecimal](BigDecimal(_).setScale(2, RoundingMode.UP), _.toString)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You probably need to change to RoundingMode.HALF_UP. Because RoundingMode.UP will round up even it's less than 5. Ex. 3.3 will become 4.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

even with the half round it still dropping the last decimal

"insert interim rent amount and start date" in {
await(repository.insertInterimRentSetByTheCourt(credId, 10000.00, "2020-1"))
val actual = await(repository.findByCredId(credId))
actual shouldBe Some(RaldUserAnswers(credId, NewAgreement, property, interimRentSetByTheCourt = Some(InterimRentSetByTheCourt(amount = "10000.0", date = "2020-1"))))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't feel right for me. I checked that BigDecimal from your form is scale to 2. But toString is missing one decimal. What do you think?

@platops-pr-bot
Copy link

@JakeReid2020 JakeReid2020 merged commit 047514d into main Sep 18, 2025
1 check passed
@JakeReid2020 JakeReid2020 deleted the NGR-1126 branch September 18, 2025 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants