BuildRequest should have a method to fetch all in-progress and pending requests for...
[WebKit.git] / Websites / perf.webkit.org / public / include / build-requests-fetcher.php
index 918bd8f255798accdb4bcf4c40f38618d2236d23..71d9d52917cc4ea109b3282a2a51c78ff2bee0b1 100644 (file)
@@ -27,8 +27,11 @@ class BuildRequestsFetcher {
 
     function fetch_incomplete_requests_for_triggerable($triggerable_id) {
         $this->rows = $this->db->query_and_fetch_all('SELECT * FROM build_requests
-            WHERE request_triggerable = $1 AND request_status != \'completed\'
-            ORDER BY request_created_at, request_group, request_order', array($triggerable_id));
+            WHERE request_triggerable = $1 AND request_group
+                IN (SELECT testgroup_id FROM analysis_test_groups WHERE EXISTS
+                    (SELECT 1 FROM build_requests WHERE testgroup_id = request_group AND request_status
+                        IN (\'pending\', \'scheduled\', \'running\')))
+            ORDER BY request_group, request_order', array($triggerable_id));
     }
 
     function fetch_request($request_id) {