Conversation
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2473 +/- ##
============================================
- Coverage 64.22% 64.21% -0.02%
+ Complexity 2419 2414 -5
============================================
Files 384 384
Lines 29231 29209 -22
Branches 4236 4228 -8
============================================
- Hits 18774 18756 -18
Misses 8189 8189
+ Partials 2268 2264 -4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Arkariang
left a comment
There was a problem hiding this comment.
Tested as well with project https://staging.kickstarter.com/projects/isabel-martin/tween-podcast-sandwich to test filtering by shipping location as the project has rewards restricted to Canada.
Seems to be working fine but there was 1 project that did not load any reward, unable to reproduce though, will require more in depth QA before releasing.
Approving as the objective of this PR was having ordering provided from the backend and changing as little as possible code. We aim to refactor soon the UseCase and VM 🙏
| * @param rewards the full list of rewards associated with the project | ||
| * @param rewards the full list of rewards (typically in ELIGIBILITY order from the server) | ||
| */ | ||
| private fun filterRewardsByLocation( |
There was a problem hiding this comment.
unsure what we ended deciding, but we were ok by not filtering and rather showing on the reward card the "unavailable" UI when shipping not available. If that's the case this entire method could potentially be deleted.
There was a problem hiding this comment.
We’re going with the “no filtering” approach. I removed filterRewardsByLocation and replaced it with setRewardsList, which only keeps backend order and puts no-reward first. We always show all rewards; the reward card shows the “unavailable” UI when shipping isn’t available for the selected location. Changes are in GetShippingRulesUseCase and the affected tests.
| * Restricted rewards are shippable only if their shipping rules contain the given locationId. | ||
| * When locationId is null, restricted rewards are considered not shippable to the selected location. | ||
| */ | ||
| fun isShippableToLocation(reward: Reward, locationId: Long?): Boolean { |
There was a problem hiding this comment.
💯
@jlpl15 make sure in RewardsUtilsTest we cover this method as well
There was a problem hiding this comment.
Would cover it on future pr
📲 What
sort: ELIGIBILITY).🤔 Why
Backend now provides the correct reward ordering (secret, featured, available, unavailable) via the ELIGIBILITY sort. we use it directly to avoid duplicating or diverging client logic and to keep ordering consistent.
🛠 How
$sort: ProjectRewardsSort = ELIGIBILITYandrewards(sort: $sort). No location parameter backend returns eligibility-sorted list.slugand optionalsort(default ELIGIBILITY). No location/country code.single call used for initial load and when shipping rule changes.getRewardsFromProject(slug)and rebuildGetShippingRulesUseCasewith the new rewards, then apply the selected rule for filtering.filteredRewards): no separate groups or client-side.sortedBy(). Adds no-reward at the front when present otherwise preserves backend order and only filters by which rewards ship to the selected location.👀 See
Staging project: https://staging.kickstarter.com/projects/1613788818/freegan-wallet-sandwich
Screen.Recording.2026-02-04.at.6.01.39.p.m.mov
video with featured rewards and rewards not available
Screen_recording_20260217_154633.webm
Video demo showing rewards still ordered correctly. Note: featured badge UI will come in a future PR this one only changes sorting without breaking existing UI.
📋 QA
Story 📖
[MBL-2992 Reward ordering](https://kickstarter.atlassian.net/browse/MBL-2992)