BuildRequest should have a method to fetch all in-progress and pending requests for...
[WebKit.git] / Websites / perf.webkit.org / public / v3 / models / test-group.js
index 9a131b40240089e5c24d1b554c6bfa8a27fcb18c..e863da0c775ab85f1c146f3fa1d1e778c58e6cbb 100644 (file)
@@ -112,7 +112,7 @@ class TestGroup extends LabeledObject {
 
     hasPending()
     {
-        return this._buildRequests.some(function (request) { return request.hasPending(); });
+        return this._buildRequests.some(function (request) { return request.isPending(); });
     }
 
     compareTestResults(rootSetA, rootSetB)
@@ -222,22 +222,7 @@ class TestGroup extends LabeledObject {
             return TestGroup.ensureSingleton(row.id, row);
         });
 
-        var rootIdMap = {};
-        for (var root of data['roots']) {
-            rootIdMap[root.id] = root;
-            root.repository = Repository.findById(root.repository);
-        }
-
-        var rootSets = data['rootSets'].map(function (row) {
-            row.roots = row.roots.map(function (rootId) { return rootIdMap[rootId]; });
-            return RootSet.ensureSingleton(row.id, row);
-        });
-
-        var buildRequests = data['buildRequests'].map(function (rawData) {
-            rawData.testGroup = TestGroup.findById(rawData.testGroup);
-            rawData.rootSet = RootSet.findById(rawData.rootSet);
-            return BuildRequest.ensureSingleton(rawData.id, rawData);
-        });
+        BuildRequest.constructBuildRequestsFromData(data);
 
         return testGroups;
     }