Guest User

Untitled

a guest
May 23rd, 2018
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.09 KB | None | 0 0
  1. commit 57ac499b5b5b6cd0a003f16a9cdfc45d12a171c6
  2. Author: Joe Van Dyk <joe@fixieconsulting.com>
  3. Date: Fri Jul 2 00:31:45 2010 -0700
  4.  
  5. Improvements to how order capturing is done
  6.  
  7. diff --git a/app/controllers/admin/orders_controller.rb b/app/controllers/admin/orders_controller.rb
  8. index ee1dc4d..8e92807 100644
  9. --- a/app/controllers/admin/orders_controller.rb
  10. +++ b/app/controllers/admin/orders_controller.rb
  11. @@ -42,8 +42,9 @@ class Admin::OrdersController < Admin::AdminController
  12.  
  13. def capture
  14. if params[:product_ids].present?
  15. - Order.capturable.for_products(params[:product_ids].join(',')).each do |o|
  16. - Resque.enqueue Tanga::Jobs::OrderCapture, o.id
  17. + product_ids = params[:product_ids]
  18. + Order.capturable.for_products(product_ids).select_one_value(:id).each do |order_id|
  19. + Resque.enqueue Tanga::Jobs::OrderCapture, order_id
  20. end
  21. flash[:notice] = "Starting to capture uncaptured orders. Refresh the page in a few minutes."
  22. else
  23. diff --git a/app/models/order.rb b/app/models/order.rb
  24. index bfaa44e..c03c0b2 100644
  25. --- a/app/models/order.rb
  26. +++ b/app/models/order.rb
  27. @@ -78,7 +78,7 @@ class Order < ActiveRecord::Base
  28. named_scope :in_work, :conditions => ["state not in (?)", DEAD_STATES]
  29. named_scope :needs_processing, :conditions => "orders.state in ('ready_for_shipping')"
  30. named_scope :with_quantity, lambda { |quantity| { :conditions => { :quantity => quantity } } }
  31. - named_scope :for_products, lambda { |*products_ids| { :conditions => ['product_id in (?)', products_ids] } }
  32. + named_scope :for_products, lambda { |products_ids| { :conditions => ['product_id in (?)', products_ids] } }
  33. named_scope :variants_sold, :select => 'sum("orders".quantity) as sum, product_size_id, product_style_id', :include => [:product_style, :product_size], :group => 'product_size_id, product_style_id', :order => 'sum desc'
  34. named_scope :without_tracking_info, :joins => "left outer join shipments on orders.id = shipments.order_id", :conditions => "shipments.order_id is null"
  35. named_scope :in_export, lambda { |export_id| {
Add Comment
Please, Sign In to add comment