optimize for dashboards

This commit is contained in:
Thein Lin Kyaw
2019-11-18 10:09:40 +06:30
parent d94dde63fe
commit a3e4cc8993
10 changed files with 321 additions and 807 deletions

View File

@@ -6,6 +6,8 @@ class SaleAudit < ApplicationRecord
belongs_to :sale
belongs_to :credit_payment, -> { where "SUBSTRING_INDEX(sale_audits.remark,'||',1) = sale_payments.sale_payment_id" }, foreign_key: "sale_id", primary_key: "sale_id", class_name: "SalePayment"
def self.sync_sale_audit_records(sale_audits)
if !sale_audits.nil?
sale_audits.each do |sa|
@@ -163,7 +165,7 @@ class SaleAudit < ApplicationRecord
end
end
end
return card_balance_amount
end