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

Custom Reports: fix broken table (#2249)

* fix broken table

* notes

* error fixes
parent 62a0a0fe
No related branches found
No related tags found
No related merge requests found
......@@ -50,10 +50,9 @@ export function ReportTable({
});
const renderItem = useCallback(
({ item, groupByItem, mode, style, key, monthsCount }) => {
({ item, groupByItem, mode, style, monthsCount }) => {
return (
<ReportTableRow
key={key}
item={item}
balanceTypeOp={balanceTypeOp}
groupByItem={groupByItem}
......
......@@ -27,22 +27,21 @@ export function ReportTableList({
const groupByItem = ['Month', 'Year'].includes(groupBy) ? 'date' : 'name';
type RenderRowProps = {
key: string;
index: number;
parent_index?: number;
style?: CSSProperties;
};
function RenderRow({ index, parent_index, style, key }: RenderRowProps) {
const item = parent_index
? data[parent_index].categories[index]
: data[index];
function RenderRow({ index, parent_index, style }: RenderRowProps) {
const item =
parent_index === undefined
? data[index]
: data[parent_index].categories[index];
return renderItem({
item,
groupByItem,
mode,
style,
key,
monthsCount,
});
}
......@@ -55,7 +54,6 @@ export function ReportTableList({
{data ? (
<>
<RenderRow
key={item.id}
index={index}
style={
item.categories && {
......
......@@ -31,6 +31,7 @@ export const ReportTableRow = memo(
const average = amountToInteger(item[balanceTypeOp]) / monthsCount;
return (
<Row
key={item.id}
collapsed={true}
style={{
color: theme.tableText,
......
......@@ -91,8 +91,9 @@ export function ReportTableTotals({
key={amountToCurrency(item[balanceTypeOp])}
value={amountToCurrency(item[balanceTypeOp])}
title={
Math.abs(item[balanceTypeOp]) > 100000 &&
amountToCurrency(item[balanceTypeOp])
Math.abs(item[balanceTypeOp]) > 100000
? amountToCurrency(item[balanceTypeOp])
: undefined
}
width="flex"
privacyFilter
......@@ -108,8 +109,9 @@ export function ReportTableTotals({
}}
value={amountToCurrency(data.totalAssets)}
title={
Math.abs(data.totalAssets) > 100000 &&
amountToCurrency(data.totalAssets)
Math.abs(data.totalAssets) > 100000
? amountToCurrency(data.totalAssets)
: undefined
}
width="flex"
privacyFilter
......@@ -121,8 +123,9 @@ export function ReportTableTotals({
}}
value={amountToCurrency(data.totalDebts)}
title={
Math.abs(data.totalDebts) > 100000 &&
amountToCurrency(data.totalDebts)
Math.abs(data.totalDebts) > 100000
? amountToCurrency(data.totalDebts)
: undefined
}
width="flex"
privacyFilter
......@@ -136,8 +139,9 @@ export function ReportTableTotals({
}}
value={amountToCurrency(data[balanceTypeOp])}
title={
Math.abs(data[balanceTypeOp]) > 100000 &&
amountToCurrency(data[balanceTypeOp])
Math.abs(data[balanceTypeOp]) > 100000
? amountToCurrency(data[balanceTypeOp])
: undefined
}
width="flex"
privacyFilter
......@@ -149,8 +153,9 @@ export function ReportTableTotals({
}}
value={integerToCurrency(Math.round(average))}
title={
Math.abs(Math.round(average / 100)) > 100000 &&
integerToCurrency(Math.round(average))
Math.abs(Math.round(average / 100)) > 100000
? integerToCurrency(Math.round(average))
: undefined
}
width="flex"
privacyFilter
......
---
category: Bugfix
authors: [carkom]
---
Fixing a bug where custom reports table graph crashes due to a type mismatch error.
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