From b7439d257432bc63b3a5c97df28dd1ae0035cca4 Mon Sep 17 00:00:00 2001 From: Kristina Lim Date: Wed, 10 Oct 2018 16:18:16 +0800 Subject: [PATCH] Fix sort for nil cells in enterprise fee summary --- .../report_data/enterprise_fee_type_total.rb | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/order_management/reports/enterprise_fee_summary/report_data/enterprise_fee_type_total.rb b/lib/order_management/reports/enterprise_fee_summary/report_data/enterprise_fee_type_total.rb index 2a15ab8a8e..9f1561824d 100644 --- a/lib/order_management/reports/enterprise_fee_summary/report_data/enterprise_fee_type_total.rb +++ b/lib/order_management/reports/enterprise_fee_summary/report_data/enterprise_fee_type_total.rb @@ -9,20 +9,20 @@ module OrderManagement :fee_calculated_on_transfer_through_name, :tax_category_name, :total_amount def <=>(other) - self.class.sortable_data(self) <=> self.class.sortable_data(other) + sortable_data <=> other.sortable_data end - def self.sortable_data(instance) + def sortable_data [ - instance.fee_type, - instance.enterprise_name, - instance.fee_name, - instance.customer_name, - instance.fee_placement, - instance.fee_calculated_on_transfer_through_name, - instance.tax_category_name, - instance.total_amount - ] + fee_type, + enterprise_name, + fee_name, + customer_name, + fee_placement, + fee_calculated_on_transfer_through_name, + tax_category_name, + total_amount + ].map { |attribute| attribute || "" } end end end