fix: close analytics review findings
This commit is contained in:
@@ -1,5 +1,11 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## [Frontend 0.11.1] - 2026-08-21
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- Preserve the explicit «Без категории» analytics filter value when requesting data.
|
||||||
|
|
||||||
## [Frontend 0.11.0 / Backend 0.10.1 / Shared 0.5.0] - 2026-08-21
|
## [Frontend 0.11.0 / Backend 0.10.1 / Shared 0.5.0] - 2026-08-21
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ router.get(
|
|||||||
from: from as string,
|
from: from as string,
|
||||||
to: to as string,
|
to: to as string,
|
||||||
accountId: accountId ? Number(accountId) : undefined,
|
accountId: accountId ? Number(accountId) : undefined,
|
||||||
categoryId: categoryId ? Number(categoryId) : undefined,
|
categoryId: categoryId !== undefined ? Number(categoryId) : undefined,
|
||||||
onlyConfirmed: onlyConfirmed === 'true',
|
onlyConfirmed: onlyConfirmed === 'true',
|
||||||
granularity: granularity as Granularity,
|
granularity: granularity as Granularity,
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -40,6 +40,9 @@ async function testQueries(): Promise<void> {
|
|||||||
assert.deepEqual({ expense: categorySummary.totalExpense, income: categorySummary.totalIncome }, { expense: 6_000, income: 0 });
|
assert.deepEqual({ expense: categorySummary.totalExpense, income: categorySummary.totalIncome }, { expense: 6_000, income: 0 });
|
||||||
const uncategorized = await getSummary({ ...params, categoryId: 0, onlyConfirmed: false }, client);
|
const uncategorized = await getSummary({ ...params, categoryId: 0, onlyConfirmed: false }, client);
|
||||||
assert.equal(uncategorized.totalExpense, 2_500);
|
assert.equal(uncategorized.totalExpense, 2_500);
|
||||||
|
assert.equal((await getSummary({ ...params, categoryId: 0, onlyConfirmed: true }, client)).totalExpense, 0);
|
||||||
|
assert.deepEqual((await getByCategory({ ...params, categoryId: 0, onlyConfirmed: false }, client)).map((item) => item.amount), [2_500]);
|
||||||
|
assert.deepEqual((await getByCategory({ ...params, categoryId: 0, onlyConfirmed: true }, client)), []);
|
||||||
assert.equal((await getSummary({ ...params, from: '2026-08-01', to: '2026-08-31' }, client)).totalExpense, 7_000);
|
assert.equal((await getSummary({ ...params, from: '2026-08-01', to: '2026-08-31' }, client)).totalExpense, 7_000);
|
||||||
assert.deepEqual((await getByCategory(params, client)).map((item) => item.amount), [6_000]);
|
assert.deepEqual((await getByCategory(params, client)).map((item) => item.amount), [6_000]);
|
||||||
const timeseries = await getTimeseries({ ...params, granularity: 'month' }, client);
|
const timeseries = await getTimeseries({ ...params, granularity: 'month' }, client);
|
||||||
@@ -48,6 +51,10 @@ async function testQueries(): Promise<void> {
|
|||||||
const partial = await getTimeseries({ ...params, from: '2026-07-02', to: '2026-07-03', granularity: 'month' }, client);
|
const partial = await getTimeseries({ ...params, from: '2026-07-02', to: '2026-07-03', granularity: 'month' }, client);
|
||||||
assert.equal(partial[0].expenseAmount, 0);
|
assert.equal(partial[0].expenseAmount, 0);
|
||||||
assert.equal(partial[0].incomeAmount, 20_000);
|
assert.equal(partial[0].incomeAmount, 20_000);
|
||||||
|
const uncategorizedSeries = await getTimeseries({ ...params, categoryId: 0, onlyConfirmed: false, granularity: 'month' }, client);
|
||||||
|
assert.equal(uncategorizedSeries[0].expenseAmount, 2_500);
|
||||||
|
const confirmedUncategorizedSeries = await getTimeseries({ ...params, categoryId: 0, onlyConfirmed: true, granularity: 'month' }, client);
|
||||||
|
assert.equal(confirmedUncategorizedSeries[0].expenseAmount, 0);
|
||||||
} finally {
|
} finally {
|
||||||
await client.query('ROLLBACK');
|
await client.query('ROLLBACK');
|
||||||
client.release();
|
client.release();
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@family-budget/frontend",
|
"name": "@family-budget/frontend",
|
||||||
"version": "0.11.0",
|
"version": "0.11.1",
|
||||||
"private": true,
|
"private": true,
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ export function AnalyticsPage() {
|
|||||||
from: period.from,
|
from: period.from,
|
||||||
to: period.to,
|
to: period.to,
|
||||||
...(accountId ? { accountId: Number(accountId) } : {}),
|
...(accountId ? { accountId: Number(accountId) } : {}),
|
||||||
...(categoryId ? { categoryId: Number(categoryId) } : {}),
|
...(categoryId !== '' ? { categoryId: Number(categoryId) } : {}),
|
||||||
...(onlyConfirmed ? { onlyConfirmed: true } : {}),
|
...(onlyConfirmed ? { onlyConfirmed: true } : {}),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user