-
Notifications
You must be signed in to change notification settings - Fork 9
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
assigning status to state on order for stockit orders #964
base: master
Are you sure you want to change the base?
Conversation
@abulsayyad123 I've made this a draft PR |
@@ -130,6 +130,7 @@ def order_record | |||
if order_params[:stockit_id] | |||
@order = Order.accessible_by(current_ability).where(stockit_id: order_params[:stockit_id]).first_or_initialize | |||
@order.assign_attributes(order_params) | |||
@order.assign_state(params[:status]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@abulsayyad123 does this get run for Stockit requests or also for normal goodcity requests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only for Stockit requests.
app/models/order.rb
Outdated
@@ -111,6 +111,10 @@ class Order < ActiveRecord::Base | |||
scope :goodcity_orders, -> { where(detail_type: "GoodCity") } | |||
scope :shipments, -> { where(detail_type: "Shipment") } | |||
|
|||
def assign_state(status) | |||
state = SHIPMENT_STATUS_MAP[status] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need a default state
state = SHIPMENT_STATUS_MAP[status] | |
state = SHIPMENT_STATUS_MAP[status] || 'processing' |
@@ -130,6 +130,7 @@ def order_record | |||
if order_params[:stockit_id] | |||
@order = Order.accessible_by(current_ability).where(stockit_id: order_params[:stockit_id]).first_or_initialize | |||
@order.assign_attributes(order_params) | |||
@order.assign_state(params[:status]) | |||
@order.stockit_activity = stockit_activity | |||
@order.stockit_contact = stockit_contact | |||
@order.stockit_organisation = stockit_organisation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we need to change this code to accept stockit shipments as well as local orders... I wonder if we wait until after we have shutdown stockit then we don't need to do anything
Ticket Link:
NOTE: Specify ticket link
What does this PR do?
FEATURE: Specify feature name
BUG: Specify bug
NOTE: Give a description of what this PR does. If it fixes any bug, specify cause of an issue and approach/solution added to fix that issue.
Impacted Areas
NOTE: List any impacted areas (e.g. Dashboard > My Active Offers > scheduled )
Screenshots
NOTE: Attach screeenshots if PR contains any UI changes
Mockup Link
Note: Specify mockup link
Linked PR's:
NOTE: If these changes are related to some existing PR or fixes any issue from existing PR changes, specify PR links.
Linked Slack conversation:
NOTE: IF there is any conversation happened for current changes in any of the slack channel, mention the slack message link.
Any Open question(s) or challenge(s):