Update User-Agent and statistics schema

This commit is contained in:
Omar Roth 2019-03-01 19:39:10 -06:00
parent 4be82c5ca6
commit 057e69fe70
2 changed files with 11 additions and 5 deletions

View file

@ -136,11 +136,17 @@ if config.statistics_enabled
},
"openRegistrations" => config.registration_enabled,
"usage" => {
"total" => PG_DB.query_one("SELECT count(*) FROM users", as: Int64),
"activeHalfyear" => PG_DB.query_one("SELECT count(*) FROM users WHERE CURRENT_TIMESTAMP - updated < '6 months'", as: Int64),
"activeMonth" => PG_DB.query_one("SELECT count(*) FROM users WHERE CURRENT_TIMESTAMP - updated < '1 month'", as: Int64),
{
"users" => {
"total" => PG_DB.query_one("SELECT count(*) FROM users", as: Int64),
"activeHalfyear" => PG_DB.query_one("SELECT count(*) FROM users WHERE CURRENT_TIMESTAMP - updated < '6 months'", as: Int64),
"activeMonth" => PG_DB.query_one("SELECT count(*) FROM users WHERE CURRENT_TIMESTAMP - updated < '1 month'", as: Int64),
},
},
},
"metadata" => {
"updatedAt" => Time.now.to_unix,
},
"updatedAt" => Time.now.to_unix,
}
sleep 1.minute