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-1586] Fix shipping costs on Add On selection #1321

Merged
merged 15 commits into from
Oct 23, 2020

Conversation

singhhari
Copy link
Contributor

@singhhari singhhari commented Oct 22, 2020

📲 What

After selecting a reward and being directed to the add on selection screen, incorrect shipping costs were being shown. We determined the issue was caused by the wrong field being fetched and used in our GraphQL query. This PR updates the query to utilize shippingRulesExpanded and updates existing schema to decode shippingRulesExpanded for use.

🤔 Why

Some creators noted the shipping costs were being calculated incorrectly on the pledge screen which suggested an issue with the way we were using shipping rules. After taking a look it appeared that were using the wrong set of shipping rules being returned from our query.

🛠 How

Made some updates to the relevant query by adding a parameter for location id, This was necessary, otherwise we would be pulling hundreds of shipping locations per add on. Moreover, we're decoding our new field and using it for filtering add ons.

✅ Acceptance criteria

Steps to test this feature:

  • Visit project with slug: dungeon-drop-dropped-too-deep-and-tavern-tales (or any project that has international shipping on production)
  • Add a Reward with an AddOn like Game Bundle in the case of the example above.
  • Add an add-on like Limited Promo Pack (2020) mini-expansion ($0 shipping) and pay attention to the price the creator has set for shipping.
  • Change shipping selector to Canada (or any country other than US)
  • See add-ons shipping cost on Limited Promo Pack (2020) mini-expansion.

Expected: shipping cost should be $0 (based on what the creator set)

@codecov
Copy link

codecov bot commented Oct 22, 2020

Codecov Report

Merging #1321 into master will increase coverage by 0.01%.
The diff coverage is 90.21%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1321      +/-   ##
==========================================
+ Coverage   85.77%   85.78%   +0.01%     
==========================================
  Files        1109     1109              
  Lines       97337    97474     +137     
==========================================
+ Hits        83492    83620     +128     
- Misses      13845    13854       +9     
Impacted Files Coverage Δ
KsApi/models/Location.swift 81.81% <0.00%> (-18.19%) ⬇️
KsApi/models/graphql/GraphReward.swift 100.00% <ø> (ø)
KsApi/models/templates/RewardTemplates.swift 0.00% <ø> (ø)
KsApi/models/lenses/RewardLenses.swift 22.54% <61.11%> (+4.47%) ⬆️
...queries/RewardAddOnSelectionViewQueriesTests.swift 91.30% <88.23%> (-8.70%) ⬇️
KsApi/GraphSchema.swift 71.53% <100.00%> (+3.56%) ⬆️
KsApi/models/Money.swift 78.57% <100.00%> (ø)
KsApi/models/Reward.swift 95.12% <100.00%> (+0.25%) ⬆️
KsApi/models/RewardTests.swift 100.00% <100.00%> (ø)
...i/models/graphql/adapters/Reward+GraphReward.swift 100.00% <100.00%> (ø)
... and 5 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 57bc3f1...43fd07e. Read the comment docs.

Copy link
Contributor

@andrewKstrt andrewKstrt left a comment

Choose a reason for hiding this comment

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

I wonder what exactly the difference between ShippingRules and ShippingRulesExpanded. What do we miss in ShippingRules?

@andrewKstrt
Copy link
Contributor

Also can you please add some Acceptance Criteria and steps to reproduce the issue.
Code change looks good

@singhhari
Copy link
Contributor Author

@andrewKstrt shippingRules unfortunately had an incorrect calculation for shipping costs which was corrected in shippingRulesExpanded. The other major difference is that shippingRulesExpanded has all possible shipping locations in the response and we filter by location to specifically get the one the user requests.

@singhhari singhhari merged commit e5fce0f into master Oct 23, 2020
@singhhari singhhari deleted the NT-1586-add-ons-shipping-costs branch October 23, 2020 14:43
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.

2 participants