changes to reviews
[build-farm.git] / buildfarm / __init__.py
index cf7f92e3aca2b63b7daa1be7cf767bc20858bde8..ec0556ab19538f2f2b1305aa432b8f6345076532 100644 (file)
@@ -144,8 +144,17 @@ class BuildFarm(object):
         return distinct_builds(result.order_by(Desc(StormBuild.upload_time)))
 
     def get_summary_builds(self):
+        """returns tree and status to the ViewSummaryPage class"""
         store = self._get_store()
-        return store.execute("SELECT tree,status FROM build GROUP BY tree,host,compiler having max(age);")
+        return store.execute("""
+SELECT obd.tree, obd.status AS status_str 
+FROM build obd
+INNER JOIN(
+       SELECT MAX(age) age, tree, host, compiler
+       FROM build
+       GROUP BY tree, host, compiler
+) ibd ON obd.age = ibd.age AND obd.tree = ibd.tree AND  obd.host = ibd.host AND obd.compiler = ibd.compiler;
+""")
 
     def get_tree_builds(self, tree):
         result = self._get_store().find(StormBuild,