Skip to content

Commit

Permalink
Merge pull request #441 from commercetools/remove_unnecessary_amount
Browse files Browse the repository at this point in the history
Remove unnecessary amount usage
  • Loading branch information
benko-balog authored Oct 7, 2022
2 parents 2bf7794 + 572176c commit 1562b9c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion util/src/main/scala/Money.scala
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ case class HighPrecisionMoney private (
def partition(ratios: Int*)(implicit mode: RoundingMode): Seq[HighPrecisionMoney] = {
val total = ratios.sum
val factor = Money.cachedCentFactor(fractionDigits)
val amountAsInt = (this.amount / factor).toBigInt
val amountAsInt = BigInt(this.preciseAmount)
val portionAmounts = ratios.map(amountAsInt * _ / total)
var remainder = portionAmounts.foldLeft(amountAsInt)(_ - _)

Expand Down

0 comments on commit 1562b9c

Please sign in to comment.