-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
[NT-241] Decimal Pledge Amount in Manage Pledge CTA Fix #908
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done, @cdolm92 . I would just add a test similar to the testPledgeCTA_Backer_LiveProject
on PledgeCTAContainerViewViewModelTests.swift
but with decimals, just to prove that it works.
@@ -160,3 +157,14 @@ private func subtitle(project: Project, pledgeState: PledgeStateCTAType) -> Stri | |||
guard let rewardTitle = reward.title else { return "\(amount)" } | |||
return "\(amount) • \(rewardTitle)" | |||
} | |||
|
|||
private func formattedPledge(amount: Double, project: Project) -> String { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @cdolm92, was there a reason for not using an NSNumberFormatter
here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@justinswart Are we using it to format decimal values elsewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ Convo resolved on slack. The formatter will be added in separate pr. cc: @justinswart
Will approve once the formatter conversation is resolved.
…pledge-amount-fix
📲 What
Users can now view their pledge amount correctly if they pledged w/ a decimal value.
🤔 Why
Some background context on why the change is needed.
🛠 How
func formattedPledge(amount: Double, project: Project) -> String
formats the backing amount. If the user backed with a whole amount we drop the decimal places.👀 See
✅ Acceptance criteria