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

[MBL-1339] Include multiple copies of add-ons if selected #2027

Merged
merged 2 commits into from
Apr 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions Library/ViewModels/ConfirmDetailsViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -314,14 +314,22 @@ public class ConfirmDetailsViewModel: ConfirmDetailsViewModelType, ConfirmDetail
let pledgeDetailsData = Signal.combineLatest(
project,
rewards,
selectedQuantities,
pledgeTotal,
refTag
)

let createCheckoutEvents = pledgeDetailsData
.takeWhen(self.continueCTATappedProperty.signal)
.map { project, rewards, pledgeTotal, refTag in
let rewardsIDs = rewards.first?.isNoReward == true ? [] : rewards.map { $0.graphID }
.map { project, rewards, selectedQuantities, pledgeTotal, refTag in
let rewardsIDs: [String] = rewards.first?.isNoReward == true
? []
: rewards.flatMap { reward -> [String] in
guard let count = selectedQuantities[reward.id] else {
return []
}
return [String](repeating: reward.graphID, count: count)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

might be a good idea to add a test for this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Discussed offline - yeah, I'd be nice, but our test suite isn't designed to test that network calls are constructed correctly. So I'm going to just leave this for now.


return CreateCheckoutInput(
projectId: project.graphID,
Expand Down