From c2a5c1a32a6a818ba4830112c5ac4e5992f14762 Mon Sep 17 00:00:00 2001 From: Mark Powers Date: Sun, 18 Oct 2020 22:27:36 -0500 Subject: Fix query --- src/server.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') 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 } -- cgit v1.2.3