]> git.donarmstrong.com Git - wannabuild.git/commitdiff
partly undo 7ce88f5df6216220b52607f09facaf312cb971c7 as that one
authorAndreas Barth <aba@not.so.argh.org>
Sun, 11 Apr 2010 12:05:54 +0000 (12:05 +0000)
committerAndreas Barth <aba@not.so.argh.org>
Sun, 11 Apr 2010 12:05:54 +0000 (12:05 +0000)
was way slower with all and installed.

bin/wanna-build

index e02706dbcff4378df2c3ae2ebc0a89a6b4930a32..9080dc7bf99b8842d390def9715ebde9168334ca 100755 (executable)
@@ -2542,9 +2542,15 @@ sub get_all_source_info {
        my %options = @_;
 
         my $q = "SELECT rel, priority, state_change, permbuildpri, section, buildpri, failed, state, binary_nmu_changelog, bd_problem, version, package, distribution, installed_version, notes, failed_category, builder, old_failed, previous_state, binary_nmu_version, depends, extract(days from date_trunc('days', now() - state_change)) as state_days"
-            . ", (SELECT max(build_time) FROM ".pkg_history_table_name()." WHERE pkg_history.package = packages.package AND pkg_history.distribution = packages.distribution AND result = 'successful') AS successtime"
-            . ", (SELECT max(build_time) FROM ".pkg_history_table_name()." WHERE pkg_history.package = packages.package AND pkg_history.distribution = packages.distribution ) AS anytime"
+#            . ", (SELECT max(build_time) FROM ".pkg_history_table_name()." WHERE pkg_history.package = packages.package AND pkg_history.distribution = packages.distribution AND result = 'successful') AS successtime"
+#            . ", (SELECT max(build_time) FROM ".pkg_history_table_name()." WHERE pkg_history.package = packages.package AND pkg_history.distribution = packages.distribution ) AS anytime"
             . " FROM " .  table_name()
+                . " left join ( "
+                  . "select distinct on (package, distribution) build_time, package, distribution from ".pkg_history_table_name()." where result = 'successful' order by package, distribution, timestamp "
+                  . " ) as successtime using (package, distribution) "
+                . " left join ( "
+                  . "select distinct on (package, distribution) build_time, package, distribution from ".pkg_history_table_name()." order by package, distribution, timestamp desc"
+                  . " ) as anytime using (package, distribution) "
            . " WHERE TRUE ";
         my @args = ();
         if ($distribution) {