Skip to content

Commit

Permalink
less sums
Browse files Browse the repository at this point in the history
  • Loading branch information
alxndrsn committed Feb 7, 2025
1 parent e401445 commit f472e09
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/model/query/analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -498,10 +498,10 @@ const getDatasets = () => ({ all }) => all(sql`
SELECT
-- not used: COUNT (*) total,
-- not used: SUM (CASE WHEN a."loggedAt" >= ${_cutoffDate} THEN 1 ELSE 0 END) recent,
SUM (CASE WHEN a."details"->'submissionDefId' IS NOT NULL THEN 1 ELSE 0 END) create_sub_total,
SUM (CASE WHEN a."details"->'submissionDefId' IS NOT NULL AND a."loggedAt" >= ${_cutoffDate} THEN 1 ELSE 0 END) create_sub_recent,
SUM (CASE WHEN a."details"->'submissionDefId' IS NULL THEN 1 ELSE 0 END) create_api_total,
SUM (CASE WHEN a."details"->'submissionDefId' IS NULL AND a."loggedAt" >= ${_cutoffDate} THEN 1 ELSE 0 END) create_api_recent,
COUNT(a.details->'submissionDefId') AS create_sub_total,
COUNT(a.details->'submissionDefId' IS NOT NULL AND a."loggedAt" >= ${_cutoffDate} OR NULL) AS create_sub_recent,
COUNT(a.details->'submissionDefId' IS NULL OR NULL) AS create_api_total,
COUNT(a.details->'submissionDefId' IS NULL AND a."loggedAt" >= ${_cutoffDate} OR NULL) AS create_api_recent,
e."datasetId"
FROM audits a
JOIN entities e on (a.details->'entityId')::INT = e.id
Expand Down

0 comments on commit f472e09

Please sign in to comment.