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

[NT-241] Decimal Pledge Amount in Manage Pledge CTA Fix #908

Merged
merged 6 commits into from
Oct 24, 2019

Conversation

cdolm92
Copy link
Contributor

@cdolm92 cdolm92 commented Oct 24, 2019

📲 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

Before 🐛 After 🦋
Simulator Screen Shot - iPhone Xs - 2019-10-24 at 15 32 10 Simulator Screen Shot - iPhone Xs - 2019-10-24 at 15 28 33

✅ Acceptance criteria

  • Navigate to a live and pledged project. Make sure that the pledge amount is formatted correctly. You should see a decimal value if you pledge a decimal amount or a whole number if you did not.

Scollaco
Scollaco previously approved these changes Oct 24, 2019
Copy link
Contributor

@Scollaco Scollaco left a 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 {
Copy link
Contributor

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?

Copy link
Contributor Author

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?

Copy link
Contributor Author

@cdolm92 cdolm92 Oct 24, 2019

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

@Scollaco Scollaco dismissed their stale review October 24, 2019 21:36

Will approve once the formatter conversation is resolved.

@cdolm92 cdolm92 merged commit 0c0faf2 into master Oct 24, 2019
@cdolm92 cdolm92 deleted the pledge-amount-fix branch October 24, 2019 22:01
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