Skip to content
Snippets Groups Projects
Unverified Commit 536cabb7 authored by Neil's avatar Neil Committed by GitHub
Browse files

Spending Report: card fix (#3135)

* spending card fix

* notes
parent cceda039
No related branches found
No related tags found
No related merge requests found
...@@ -140,7 +140,7 @@ export function SpendingGraph({ ...@@ -140,7 +140,7 @@ export function SpendingGraph({
const lastYear = monthUtils.prevYear(monthUtils.currentMonth()); const lastYear = monthUtils.prevYear(monthUtils.currentMonth());
let selection; let selection;
switch (mode) { switch (mode) {
case 'Average': case 'average':
selection = 'average'; selection = 'average';
break; break;
case 'lastYear': case 'lastYear':
......
...@@ -321,8 +321,8 @@ export function Spending() { ...@@ -321,8 +321,8 @@ export function Spending() {
)} )}
{showAverage && ( {showAverage && (
<ModeButton <ModeButton
selected={mode === 'Average'} selected={mode === 'average'}
onSelect={() => setMode('Average')} onSelect={() => setMode('average')}
> >
Average Average
</ModeButton> </ModeButton>
......
...@@ -40,7 +40,7 @@ export function SpendingCard() { ...@@ -40,7 +40,7 @@ export function SpendingCard() {
: monthUtils.getDay(monthUtils.currentDay()) - 1; : monthUtils.getDay(monthUtils.currentDay()) - 1;
const difference = const difference =
data && data &&
data.intervalData[todayDay].lastMonth - data.intervalData[todayDay][spendingReportTime] -
data.intervalData[todayDay].thisMonth; data.intervalData[todayDay].thisMonth;
const showLastMonth = data && Math.abs(data.intervalData[27].lastMonth) > 0; const showLastMonth = data && Math.abs(data.intervalData[27].lastMonth) > 0;
......
...@@ -32,6 +32,8 @@ export type balanceTypeOpType = ...@@ -32,6 +32,8 @@ export type balanceTypeOpType =
| 'netAssets' | 'netAssets'
| 'netDebts'; | 'netDebts';
export type spendingReportTimeType = 'lastMonth' | 'lastYear' | 'average';
export type SpendingMonthEntity = Record< export type SpendingMonthEntity = Record<
string | number, string | number,
{ {
......
import { type numberFormats } from '../shared/util'; import { type numberFormats } from '../shared/util';
import { spendingReportTimeType } from './models/reports';
export type FeatureFlag = export type FeatureFlag =
| 'reportBudget' | 'reportBudget'
| 'goalTemplatesEnabled' | 'goalTemplatesEnabled'
...@@ -51,7 +53,7 @@ export type LocalPrefs = Partial< ...@@ -51,7 +53,7 @@ export type LocalPrefs = Partial<
reportsViewSummary: boolean; reportsViewSummary: boolean;
reportsViewLabel: boolean; reportsViewLabel: boolean;
spendingReportFilter: string; spendingReportFilter: string;
spendingReportTime: string; spendingReportTime: spendingReportTimeType;
sidebarWidth: number; sidebarWidth: number;
'mobile.showSpentColumn': boolean; 'mobile.showSpentColumn': boolean;
} & Record<`flags.${FeatureFlag}`, boolean> } & Record<`flags.${FeatureFlag}`, boolean>
......
---
category: Bugfix
authors: [carkom]
---
Fixes spending card that doesn't show the correct difference number.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment