Fix UnboundLocalError in checkout endpoint (ANDROID-DN)#1379
Draft
cursor[bot] wants to merge 1 commit intomasterfrom
Draft
Fix UnboundLocalError in checkout endpoint (ANDROID-DN)#1379cursor[bot] wants to merge 1 commit intomasterfrom
cursor[bot] wants to merge 1 commit intomasterfrom
Conversation
…ckout The quantities variable was being referenced in len(quantities) before it was assigned from cart['quantities']. This caused an UnboundLocalError that resulted in HTTP 500 responses from the /checkout endpoint. Fixed by moving the assignment of quantities before the empty cart check. Fixes ANDROID-DN
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
|
@sentry review |
Codecov Report❌ Patch coverage is
❌ Your project check has failed because the head coverage (22.01%) is below the target coverage (35.00%). You can increase the head coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## master #1379 +/- ##
=======================================
Coverage 22.01% 22.01%
=======================================
Files 42 42
Lines 1363 1363
Branches 176 175 -1
=======================================
Hits 300 300
Misses 1036 1036
Partials 27 27
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixed an
UnboundLocalErrorin the Flask backend's/checkoutendpoint that was causing HTTP 500 responses and triggering downstream errors in the Android app.Problem
The
quantitiesvariable was being referenced inlen(quantities)before it was assigned fromcart['quantities']. This caused anUnboundLocalErrorthat resulted in:MainFragment$BackendAPIException: Failed to init delivery workflowSolution
Moved the assignment of
quantitiesfromcart['quantities']to occur before the empty cart check.Code Changes
Before:
After:
Testing
python3 -m py_compileFixes ANDROID-DN