Skip to content

Commit

Permalink
fix: Expense buget stats to count distinct expense ids (#9872)
Browse files Browse the repository at this point in the history
  • Loading branch information
kewitz authored Feb 27, 2024
1 parent 256f902 commit c393e57
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions server/models/Expense.ts
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ class Expense extends Model<InferAttributes<Expense>, InferCreationAttributes<Ex
`
SELECT
TRIM(UNNEST(COALESCE(e."tags", '{"${noTag}"}'))) AS label,
COUNT(e."id") as "count",
COUNT(DISTINCT e."id") as "count",
ABS(SUM(t."amount")) as "amount",
t."currency" as "currency"
FROM "Expenses" e
Expand Down Expand Up @@ -518,7 +518,7 @@ class Expense extends Model<InferAttributes<Expense>, InferCreationAttributes<Ex
SELECT
DATE_TRUNC(:timeUnit, t."createdAt") AS "date",
TRIM(UNNEST(COALESCE(e."tags", '{"${noTag}"}'))) AS label,
COUNT(e."id") as "count",
COUNT(DISTINCT e."id") as "count",
ABS(SUM(t."amount")) as "amount",
t."currency" as "currency"
FROM "Expenses" e
Expand Down

0 comments on commit c393e57

Please sign in to comment.