-
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
[MBL-1197] Show unavailable rewards last #1947
Conversation
@@ -44,6 +44,7 @@ final class RewardsCollectionViewControllerTests: TestCase { | |||
func testRewards_NonBacker_LiveProject_Landscape() { | |||
let project = Project.cosmicSurgery | |||
|> Project.lens.state .~ .live | |||
|> Project.lens.rewardData.rewards %~ { Array($0[1...3]) } |
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.
This just reduces the number of items so that the unavailable one shows as well, even when it's last
@@ -77,24 +74,23 @@ final class RewardsCollectionViewControllerTests: TestCase { | |||
|> Backing.lens.rewardId .~ reward.id | |||
|> Backing.lens.shippingAmount .~ 10 | |||
|> Backing.lens.amount .~ 700.0 | |||
|> Backing.lens.addOns .~ [] |
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.
Opting out of add ons here ensures that this reward will be shown as unavailable when it's not selected. The default addOn has the same reward id as one of the rewards, which messes with our count for the reward.
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.
LGTM 👍
📲 What
Order rewards so that unavailable ones are shown last. Note that we will need to update the
rewardIsAvailable
utility method to include post campaign backings, but outside of that, this sorting will work for both.This also deletes unnecessary snapshots for the rewards tests in the first commit. The first commit looks pretty large, but it's mostly indentation changes and deleted snapshots. The second commit is the actual sorting code, with some test changes to make the tests more relevant. I recommend reviewing this one commit at a time.
👀 See
Jira and snapshot tests.
✅ Acceptance criteria