From efaa3669c182e68d43b68a1f4257b483aad55f01 Mon Sep 17 00:00:00 2001 From: Shinya Maeda Date: Mon, 1 Oct 2018 13:38:37 +0900 Subject: Change the order of status_sql to avoid the query for scheduled status at the earlier step --- app/models/concerns/has_status.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/concerns/has_status.rb b/app/models/concerns/has_status.rb index 88a0c9919e7..b92643f87f8 100644 --- a/app/models/concerns/has_status.rb +++ b/app/models/concerns/has_status.rb @@ -33,7 +33,6 @@ module HasStatus warnings = scope_warnings.select('count(*) > 0').to_sql.presence || 'false' "(CASE - WHEN (#{scheduled})>0 THEN 'scheduled' WHEN (#{builds})=(#{skipped}) AND (#{warnings}) THEN 'success' WHEN (#{builds})=(#{skipped}) THEN 'skipped' WHEN (#{builds})=(#{success}) THEN 'success' @@ -43,6 +42,7 @@ module HasStatus WHEN (#{builds})=(#{created})+(#{skipped})+(#{pending}) THEN 'pending' WHEN (#{running})+(#{pending})>0 THEN 'running' WHEN (#{manual})>0 THEN 'manual' + WHEN (#{scheduled})>0 THEN 'scheduled' WHEN (#{created})>0 THEN 'running' ELSE 'failed' END)" -- cgit v1.2.1