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

fix: Fail order status transition to pending if incomplete attendee info #7113

Merged
merged 7 commits into from
Jul 7, 2020

Conversation

Haider8
Copy link
Contributor

@Haider8 Haider8 commented Jul 5, 2020

Fixes #7069

Short description of what this resolves:

Right now order status can be transitioned to pending even if corresponding attendees have incomplete info, which is incorrect.

Changes proposed in this pull request:

Fail order status transitioning to pending if incomplete attendee info

Checklist

  • I have read the Contribution & Best practices Guide and my PR follows them.
  • My branch is up-to-date with the Upstream development branch.
  • The unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • All the functions created/modified in this PR contain relevant docstrings.

@auto-label auto-label bot added the fix label Jul 5, 2020
@codecov
Copy link

codecov bot commented Jul 5, 2020

Codecov Report

Merging #7113 into development will increase coverage by 0.04%.
The diff coverage is 100.00%.

Impacted file tree graph

@@               Coverage Diff               @@
##           development    #7113      +/-   ##
===============================================
+ Coverage        62.80%   62.84%   +0.04%     
===============================================
  Files              262      262              
  Lines            13005    13011       +6     
===============================================
+ Hits              8168     8177       +9     
+ Misses            4837     4834       -3     
Impacted Files Coverage Δ
app/api/orders.py 40.97% <100.00%> (+1.71%) ⬆️

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 3edde45...b40b1bb. Read the comment docs.

@@ -379,6 +381,13 @@ def before_update_object(self, order, data, view_kwargs):
:param view_kwargs:
:return:
"""
if data.get('status') == 'pending':
Copy link
Member

Choose a reason for hiding this comment

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

Can be completed or placed as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So should I just make this data.get('status') != 'initializing' ?

Copy link
Member

Choose a reason for hiding this comment

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

No, because this should not run order is being cancelled.

@iamareebjamal
Copy link
Member

iamareebjamal commented Jul 7, 2020

Please test manually that placed orders and order cancellation is working using the frontend

@iamareebjamal
Copy link
Member

You have added tests for failure case, great. Also add tests for success case, where attendees have correct data and order is successfully changed to pending state. Just adding for complex custom forms is enough

@Haider8
Copy link
Contributor Author

Haider8 commented Jul 7, 2020

Also add tests for success case, where attendees have correct data and order is successfully changed to pending state

Will do this once I cover placed and completed also in failure test

@iamareebjamal
Copy link
Member

iamareebjamal commented Jul 7, 2020

That'd be repetition of test logic. Just use pending in one test and placed in another and that'd be enough IMO

I'm talking about the current 2 failure test cases

@iamareebjamal
Copy link
Member

Add success case as well

@niranjan94
Copy link
Member

Codacy Here is an overview of what got changed by this pull request:

Complexity increasing per file
==============================
- tests/all/integration/api/helpers/order/test_edit_order.py  3
- app/api/orders.py  2
         

Clones added
============
- tests/all/integration/api/helpers/order/test_edit_order.py  4
         

See the complete overview on Codacy

@iamareebjamal iamareebjamal merged commit ef2d75b into fossasia:development Jul 7, 2020
@Haider8 Haider8 deleted the issue-7069 branch July 12, 2020 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Order should fail to transition to pending state if attendee info is incomplete
3 participants