diff options
author | Mark Powers <markppowers0@gmail.com> | 2020-10-18 22:27:36 -0500 |
---|---|---|
committer | Mark Powers <markppowers0@gmail.com> | 2020-10-18 22:27:36 -0500 |
commit | c2a5c1a32a6a818ba4830112c5ac4e5992f14762 (patch) | |
tree | ba034eaf4908eb1b302857e2b345705865f3810b /src | |
parent | 3e16b66c86b59f7f6045f29ac66e4fae37d99e0d (diff) |
Fix query
Diffstat (limited to 'src')
-rw-r--r-- | src/server.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/server.js b/src/server.js index c108a00..5d6cf9f 100644 --- a/src/server.js +++ b/src/server.js @@ -313,8 +313,8 @@ async function formatSummary(database, username) { summary.week_avg = getBudgetAverage(summary.week) - summary.categories = await database.query(`select category, sum(amount) as s from transactions where category <> '' group by category`, { type: database.QueryTypes.SELECT }); - summary.subcategories = await database.query(`select subcategory, sum(amount) as s from transactions where subcategory <> '' group by subcategory`, { type: database.QueryTypes.SELECT }); + summary.categories = await database.query(`select category, sum(amount) as s from transactions where username = '${username}' and category <> '' group by category`, { type: database.QueryTypes.SELECT }); + summary.subcategories = await database.query(`select subcategory, sum(amount) as s from transactions where username = '${username}' and subcategory <> '' group by subcategory`, { type: database.QueryTypes.SELECT }); summary.name = username return summary } |