implement soft delete for money moves

This commit is contained in:
Bilal
2020-10-09 16:12:44 +03:00
parent f2af0639f3
commit 722fc71f17
5 changed files with 17 additions and 3 deletions

View File

@@ -7,7 +7,7 @@ class Homie < ApplicationRecord
def self.info(importance, gang)
# TODO: This can be improved
cash_totals = Homie.all.joins(:money_moves).group(:id).order(:id).sum(:amount)
cash_totals = Homie.all.joins(:money_moves).where(money_moves: { deleted_at: nil}).group(:id).order(:id).sum(:amount)
work_totals = Homie.all.joins(:work).group(:id).order(:id).sum(:amount)
Homie.where(['importance > ? and gang_id = ?', importance, gang]).map do |homie|