Filtering investments are based on the latest milestone status
This commit is contained in:
@@ -6,7 +6,7 @@ module BudgetExecutionsHelper
|
||||
.winners
|
||||
.joins(:milestones)
|
||||
.distinct
|
||||
.where('budget_investment_milestones.status_id = ?', params[:status])
|
||||
.where(filter_investment_by_latest_milestone, params[:status])
|
||||
else
|
||||
heading.investments
|
||||
.winners
|
||||
@@ -15,4 +15,11 @@ module BudgetExecutionsHelper
|
||||
end
|
||||
end
|
||||
|
||||
def filter_investment_by_latest_milestone
|
||||
<<-SQL
|
||||
(SELECT status_id FROM budget_investment_milestones
|
||||
WHERE investment_id = budget_investments.id ORDER BY publication_date DESC LIMIT 1) = ?
|
||||
SQL
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user