Created
November 25, 2014 15:16
-
-
Save joeljackson/e9e165096653836bae60 to your computer and use it in GitHub Desktop.
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
orders = Order.joins(:order_state_transitions).where("order_state_transitions.to = 'charged'").order('id DESC').limit(50000).includes(:linked_orders).to_a; nil | |
bad_orders = orders.find_all{ |order| order.linked_orders.length > 1 && order.linked_orders.find_all{ |o| o.order_classification == 0 && o.state == 'start_order'}.length > 1}; nil | |
dup_orders = multi_followon_orders.map(&:linked_orders).map{ |linked_orders| linked_orders - linked_orders.uniq_by{ |o| "#{o.kid.try(:id)}#{o.user_selected_ship_date.to_s}#{o.line_items.map(&:variant_id).join}"} }; nil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment