]> git.nbdom.net Git - nb.git/commitdiff
etc/dbq/data.php
authorNicolas Boisselier <nicolas.boisselier@gmail.com>
Wed, 16 Oct 2024 20:22:12 +0000 (22:22 +0200)
committerNicolas Boisselier <nicolas.boisselier@gmail.com>
Wed, 16 Oct 2024 20:22:12 +0000 (22:22 +0200)
etc/dbq/data.php

index 83d589cebcf903f36a9395385794d473120a9e04..8ddddf617891902b788e15e579d4193f2b05a28e 100644 (file)
@@ -54,15 +54,20 @@ $DBQ['data'] = [
                                        },
                        ],
                        'host_info_git' => [
+                                       /*
+                                                       ,0 as count
+                                                       ,(SELECT string_agg((name.val),' ') as repos FROM host_info name WHERE name.host=hi.host AND name.key LIKE 'git.%.name') as repos
+                                       */
                                        'sql' => preg_replace('/[\t\r\n]/','',"
                                                SELECT host
                                                        ,max(updated) as last_updated
                                                        ,min(updated) as first_updated
-                                                       ,0 as count
-                                                       ,(SELECT max(CAST(ex.val as INTEGER)) as exit FROM host_info ex
+                                                       ,(SELECT count(count.val) FROM host_info count
+                                                                WHERE count.host=hi.host AND count.key LIKE 'git.%.name'
+                                                       ) as count
+                                                       ,(SELECT max(CAST(ex.val as INTEGER)) FROM host_info ex
                                                                 WHERE ex.host=hi.host AND ex.key LIKE 'git.%.exit_code'
                                                        ) as exit
-                                                       ,(SELECT string_agg((name.val),' ') as repos FROM host_info name WHERE name.host=hi.host AND name.key LIKE 'git.%.name') as repos
                                                         FROM host_info hi
                                                         WHERE key LIKE 'git.%'
                                                         GROUP BY host ORDER BY last_updated DESC, host