Skip to content

Commit

Permalink
Match criteria to fetch loans in both charts
Browse files Browse the repository at this point in the history
  • Loading branch information
Novruu committed Nov 19, 2024
1 parent a9a1a2b commit f7b2418
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion app/controllers/admin/dashboard_beta_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ def initialize_wice_grid(projects, person_id)
end

def prep_projects_stack_graph
stack_loans = Loan.where(division_id: :id, status_value: 'active').order(signing_date: :desc).select { |t| t.txns_count > 0 }.take(7)
stack_loans = (@division.parent.nil? \
? Loan.where(division_id: @division.self_and_descendants.pluck(:id)) \
: @division.loans).and(Loan.where(status_value: 'active')).order(signing_date: :desc).select { |t| t.txns_count > 0 }.take(7)

@stack_data = stack_loans.map do |loan|
start_date = loan.signing_date || loan.created_at.to_date
Expand Down

0 comments on commit f7b2418

Please sign in to comment.