Commit 7f08d4d1 authored by David Morley's avatar David Morley

fix monthly stats, needed a constant

parent 808b166a
Pipeline #762 passed with stage
in 3 minutes and 35 seconds
......@@ -22,6 +22,7 @@ $softwares = [
'pleroma' => ['repo' => 'pleroma%2fpleroma', 'gitsite' => 'git.pleroma.social', 'gittype' => 'gitlab', 'devbranch' => 'develop'],
'socialhome' => ['repo' => 'jaywink/socialhome', 'gitsite' => 'api.github.com', 'gittype' => 'github', 'devbranch' => ''],
'social-relay' => ['repo' => 'jaywink/social-relay', 'gitsite' => 'api.github.com', 'gittype' => 'github', 'devbranch' => ''],
'writefreely' => ['repo' => 'writeas/writefreely', 'gitsite' => 'api.github.com', 'gittype' => 'github', 'devbranch' => 'develop'],
'ganggo' => ['repo' => 'ganggo%2fganggo', 'gitsite' => 'git.feneas.org', 'gittype' => 'gitlab', 'devbranch' => ''],
'funkwhale' => ['repo' => 'funkwhale%2ffunkwhale', 'gitsite' => 'code.eliotberriot.com', 'gittype' => 'gitlab', 'devbranch' => 'develop'],
];
......
......@@ -19,10 +19,10 @@ try {
$monthly_totals = R::getAll("
SELECT
to_char(date_checked, 'yyyy-mm') AS yymm,
sum(total_users) / count(DISTINCT to_char(date_checked, 'HH24 dd')) as users,
sum(local_posts) / count(DISTINCT to_char(date_checked, 'HH24 dd')) as posts,
sum(comment_counts) / count(DISTINCT to_char(date_checked, 'HH24 dd')) as comments,
count(domain) / count(DISTINCT to_char(date_checked, 'HH24 dd')) as pods,
sum(total_users) / COUNT(DISTINCT CASE WHEN domain = 'diasp.org' THEN id ELSE NULL END) as users,
sum(local_posts) / COUNT(DISTINCT CASE WHEN domain = 'diasp.org' THEN id ELSE NULL END) as posts,
sum(comment_counts) / COUNT(DISTINCT CASE WHEN domain = 'diasp.org' THEN id ELSE NULL END) as comments,
count(domain) / COUNT(DISTINCT CASE WHEN domain = 'diasp.org' THEN id ELSE NULL END) as pods,
count(nullif(online, false)) as uptime,
count(nullif(online, true)) as downtime
FROM checks
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment