Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- commit 57ac499b5b5b6cd0a003f16a9cdfc45d12a171c6
- Author: Joe Van Dyk <joe@fixieconsulting.com>
- Date: Fri Jul 2 00:31:45 2010 -0700
- Improvements to how order capturing is done
- diff --git a/app/controllers/admin/orders_controller.rb b/app/controllers/admin/orders_controller.rb
- index ee1dc4d..8e92807 100644
- --- a/app/controllers/admin/orders_controller.rb
- +++ b/app/controllers/admin/orders_controller.rb
- @@ -42,8 +42,9 @@ class Admin::OrdersController < Admin::AdminController
- def capture
- if params[:product_ids].present?
- - Order.capturable.for_products(params[:product_ids].join(',')).each do |o|
- - Resque.enqueue Tanga::Jobs::OrderCapture, o.id
- + product_ids = params[:product_ids]
- + Order.capturable.for_products(product_ids).select_one_value(:id).each do |order_id|
- + Resque.enqueue Tanga::Jobs::OrderCapture, order_id
- end
- flash[:notice] = "Starting to capture uncaptured orders. Refresh the page in a few minutes."
- else
- diff --git a/app/models/order.rb b/app/models/order.rb
- index bfaa44e..c03c0b2 100644
- --- a/app/models/order.rb
- +++ b/app/models/order.rb
- @@ -78,7 +78,7 @@ class Order < ActiveRecord::Base
- named_scope :in_work, :conditions => ["state not in (?)", DEAD_STATES]
- named_scope :needs_processing, :conditions => "orders.state in ('ready_for_shipping')"
- named_scope :with_quantity, lambda { |quantity| { :conditions => { :quantity => quantity } } }
- - named_scope :for_products, lambda { |*products_ids| { :conditions => ['product_id in (?)', products_ids] } }
- + named_scope :for_products, lambda { |products_ids| { :conditions => ['product_id in (?)', products_ids] } }
- 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'
- named_scope :without_tracking_info, :joins => "left outer join shipments on orders.id = shipments.order_id", :conditions => "shipments.order_id is null"
- named_scope :in_export, lambda { |export_id| {
Add Comment
Please, Sign In to add comment