fix job count on analytics

This commit is contained in:
keyan 2023-05-04 13:13:55 -05:00
parent 0d347c7221
commit b59f277a3b
1 changed files with 2 additions and 2 deletions

View File

@ -94,8 +94,8 @@ export default {
`${withClause(when)}
SELECT time, json_build_array(
json_build_object('name', 'comments', 'value', count("parentId")),
json_build_object('name', 'jobs', 'value', count("subName")),
json_build_object('name', 'posts', 'value', count("Item".id)-count("parentId")-count("subName"))
json_build_object('name', 'jobs', 'value', count("subName") FILTER (WHERE "subName" = 'jobs')),
json_build_object('name', 'posts', 'value', count("Item".id)-count("parentId")-(count("subName") FILTER (WHERE "subName" = 'jobs')))
) AS data
FROM times
LEFT JOIN "Item" ON ${intervalClause(when, 'Item', true)} time = date_trunc('${timeUnit(when)}', created_at)