From 8bae89eeac5717c497429c8f245123cb8af13c48 Mon Sep 17 00:00:00 2001 From: Thein Lin Kyaw Date: Fri, 22 May 2020 17:28:23 +0630 Subject: [PATCH] update rake shift_sales:audit --- lib/tasks/shift_sales.rake | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/tasks/shift_sales.rake b/lib/tasks/shift_sales.rake index 7c814f31..9f7e92b3 100644 --- a/lib/tasks/shift_sales.rake +++ b/lib/tasks/shift_sales.rake @@ -1,6 +1,6 @@ namespace :shift_sales do desc "TODO" - task :audit, [:shift_sale_ids, :repayment] => [:environment] do |tasks, args| + task :audit, [:shift_sale_ids, :shop_code, :repayment] => [:environment] do |tasks, args| Rails.logger = Logger.new(STDOUT) if args[:shift_sale_ids].empty? @@ -38,13 +38,10 @@ namespace :shift_sales do sale.grand_total = sale.total_amount - sale.total_discount + sale.total_tax sale.old_grand_total = grand_total - license = License.new(ENV["SX_PROVISION_URL"]) - shop_name = license.read_license_no_decrypt("shop_name") - - shop = if Rails.env.production? || shop_name.present? - Shop.find_by(name: shop_name) + if args[:shop_code] + shop = Shop.find_by!(shop_code: args[:shop_code]) else - Shop.first + shop = Shop.first end if shop.is_rounding_adj