Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EP-480: Checkout Decimal Properties #1207

Merged
merged 8 commits into from
Apr 15, 2021

Conversation

sunday-okpoluaefe
Copy link
Contributor

📲 What

Android QA: Checkout Decimal Properties

🤔 Why

Convert checkout properties checkout_add_ons_minimum_usd checkout_bonus_amount_usd checkout_shipping_amount_usd checkout_reward_minimum_usd
from float to decimal

🛠 How

  • Created an extension Double.multiplyRound2Decimal to Double.
fun Double.multiplyRound2Decimal(other: Double, scale: Int = 2) : Double {
    return BigDecimal(this).multiply(BigDecimal(other)).setScale(scale, RoundingMode.HALF_UP).toDouble()
}

  • Added unit test
fun testMultiply2RoundDecimal() {

        val val1 = 2.0212
        val val2 = 6.0443

        val expected = 12.22

        assertEquals(val1.multiplyRound2Decimal(val2), expected)
    }

👀 See

Trello, screenshots, external resources?

Before 🐛 After 🦋

📋 QA

Instructions for anyone to be able to QA this work.

Story 📖

https://kickstarter.atlassian.net/browse/EP-480

@leighdouglas leighdouglas self-assigned this Apr 14, 2021
@@ -388,6 +389,7 @@ interface BackingFragmentViewModel {
.compose(bindToLifecycle())
.subscribe {
this.lake.trackManagePledgePageViewed(it.first, it.second)
Log.e("HERE", "GOTCHA")
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: remove log statement

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor

@leighdouglas leighdouglas left a comment

Choose a reason for hiding this comment

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

Looks great! 🎉 Just update the summary of this PR when you have a chance. And three small things:

  1. Please remove the log statement before merging
  2. Up to you if you want to remove the multiplyRound2Decimal extension method, since we aren't using it anymore
  3. Should we update the effected properties in SegmentTest to make sure we are sending a doubles now?

Great work on this! 🚀

@sunday-okpoluaefe
Copy link
Contributor Author

Looks great! 🎉 Just update the summary of this PR when you have a chance. And three small things:

  1. Please remove the log statement before merging
  2. Up to you if you want to remove the multiplyRound2Decimal extension method, since we aren't using it anymore
  3. Should we update the effected properties in SegmentTest to make sure we are sending a doubles now?

Great work on this! 🚀

*3 - All tests that send checkout properties automatically use the Double.round() method. All test passed

@sunday-okpoluaefe sunday-okpoluaefe merged commit ca6ead1 into master Apr 15, 2021
@sunday-okpoluaefe sunday-okpoluaefe deleted the sunday/ep-480-checkout-decimal-properties branch April 15, 2021 15:00
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.

2 participants