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

assigning status to state on order for stockit orders #964

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

steveyken
Copy link
Member

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):

@steveyken steveyken requested a review from abulsayyad123 April 1, 2020 06:12
@steveyken
Copy link
Member Author

@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])
Copy link
Member Author

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?

Copy link
Contributor

Choose a reason for hiding this comment

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

Only for Stockit requests.

@@ -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]
Copy link
Member Author

@steveyken steveyken Apr 1, 2020

Choose a reason for hiding this comment

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

Need a default state

Suggested change
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
Copy link
Member Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants