File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -17,14 +17,17 @@ def index
1717
1818 # Compute last_review_entry_at in SQL (max journal_entries.created_at from approved admin reviews)
1919 # Use MAX over VALUES to handle NULLs correctly (GREATEST returns NULL if either arg is NULL)
20- last_review_entry_at_sql = <<~SQL . squish
20+ build_approved = BuildReview . results . fetch ( "approved" )
21+ design_approved = DesignReview . results . fetch ( "approved" )
22+
23+ last_review_entry_at_sql = ActiveRecord ::Base . sanitize_sql_array ( [ <<~SQL . squish , build_approved , design_approved ] )
2124 (SELECT MAX(ts) FROM (VALUES
2225 ((SELECT MAX(je.created_at) FROM build_reviews br
2326 JOIN journal_entries je ON je.review_type = 'BuildReview' AND je.review_id = br.id
24- WHERE br.project_id = projects.id AND br.result = #{ BuildReview . results [ :approved ] } AND br.invalidated = FALSE AND br.admin_review = TRUE)),
27+ WHERE br.project_id = projects.id AND br.result = ? AND br.invalidated = FALSE AND br.admin_review = TRUE)),
2528 ((SELECT MAX(je.created_at) FROM design_reviews dr
2629 JOIN journal_entries je ON je.review_type = 'DesignReview' AND je.review_id = dr.id
27- WHERE dr.project_id = projects.id AND dr.result = #{ DesignReview . results [ :approved ] } AND dr.invalidated = FALSE AND dr.admin_review = TRUE))
30+ WHERE dr.project_id = projects.id AND dr.result = ? AND dr.invalidated = FALSE AND dr.admin_review = TRUE))
2831 ) AS v(ts))
2932 SQL
3033
You can’t perform that action at this time.
0 commit comments