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-521] Fix No Reward minimum conversion bug #924

Merged
merged 4 commits into from
Nov 4, 2019
Merged

[NT-521] Fix No Reward minimum conversion bug #924

merged 4 commits into from
Nov 4, 2019

Conversation

ifbarrera
Copy link
Contributor

πŸ“² What

Fixes a bug where if a user pledged to a project with No Reward, they would not see the correct reward minimum conversion value.

πŸ€” Why

πŸ› s

πŸ›  How

Our shared function reward(fromBacking:inProject) which is used to access the full reward object from a backing's rewardId, had a bug where if the backing's reward was No Reward (and consequently had a rewardId of nil), we should return our local Reward.noReward object in that function. This template object should actually never be returned, because it doesn't have an accurate minimum or convertedMinimum value (these values depend on the project). The way to solve this is actually to search for the No Reward reward in the project's list of rewards (by searching for the reward with an id of 0). This is actually the No Reward Reward that we want, with the correct minimum and convertedMinimum values for the backed project.

So, the fix was to tweak that shared function to search for the No Reward Reward in the list of rewards from the project.

πŸ‘€ See

After πŸ¦‹ Before πŸ›
Simulator Screen Shot - iPhone 8 - 2019-10-31 at 15 06 54 Simulator Screen Shot - iPhone 8 - 2019-10-31 at 16 39 31

♿️ Accessibility

N/A

🏎 Performance

N/A

βœ… Acceptance criteria

  • Back a project that's in a different currency than your preferred currency. Make sure to back it by selecting the "No Reward" option. Navigate to the manage/view pledge screen. You should see the reward minimum conversion label in the "Selected reward" section, and the conversion should not be $0 (it should be the correct conversion value).

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.

Nice @ifbarrera . I just left a comment (also asked on Slack) ⭐️

XCTAssertEqual(noReward, reward(from: backing, inProject: project))
}

func testRewardFromBackingWithProject_WhenRewardNotPresent_NoRewardNotPresent() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible to have a project with no NoReward? πŸ€”

Copy link
Contributor

Choose a reason for hiding this comment

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

According to @ifbarrera , it's probable that there's no project with no NoReward, but this test would cover this weird case if it happens.

@ifbarrera ifbarrera merged commit 25bf7b2 into master Nov 4, 2019
@ifbarrera ifbarrera deleted the NT-521 branch November 4, 2019 21:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants