Commit 9f31c114 authored by Igor Drozdov's avatar Igor Drozdov

Pass CTE table instead of Hash in a scope

parent 4c8c5a0a
......@@ -12,7 +12,7 @@ module EE
prepended do
scope :latest, -> do
with(
latest_by_project: select(:project_id, 'MAX(date) AS date').group(:project_id)
::Gitlab::SQL::CTE.new(:latest_by_project, select(:project_id, 'MAX(date) AS date').group(:project_id)).to_arel
)
.joins(
'JOIN latest_by_project ON ci_daily_build_group_report_results.date = latest_by_project.date
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment