Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removing nonNull items as they are causing errors when they are null … #1135

Merged
merged 2 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ type FinancialAccountEntriesResponse {

type FinancialAccountEntry {
id: ID!
amount: String!
currency: String!
code: String!
description: String!
entryDate: ISO8601Date!
type: String!
amount: String
currency: String
code: String
description: String
entryDate: ISO8601Date
type: String
category: FinancialAccountCategory!
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import { DataGrid, GridColDef, GridSortModel } from '@mui/x-data-grid';
import { DateTime } from 'luxon';
import { useTranslation } from 'react-i18next';
import { Maybe } from 'src/graphql/types.generated';
import { useLocale } from 'src/hooks/useLocale';
import { currencyFormat, dateFormatShort } from 'src/lib/intlFormat';
import { formatNumber } from '../../AccountSummary/AccountSummaryHelper';
Expand Down Expand Up @@ -61,15 +62,15 @@

interface TransactionRow {
id: string;
code: string;
description: string;
type: string;
code?: Maybe<string>;
description?: Maybe<string>;
type?: Maybe<string>;
categoryName: string;
categoryCode: string;
currency: string;
expenseAmount?: string;
incomeAmount?: string;
entryDate: DateTime<boolean>;
currency?: Maybe<string>;
expenseAmount?: Maybe<string>;
incomeAmount?: Maybe<string>;
entryDate: DateTime<boolean> | string;
}

const createTransactionRow = (
Expand All @@ -85,7 +86,9 @@
...amounts,
categoryName: entry.category.name ?? entry.category.code ?? '',
categoryCode: entry.category.code ?? '',
entryDate: DateTime.fromISO(entry.entryDate),
entryDate: entry.entryDate
? DateTime.fromISO(entry.entryDate)
: 'No entry date',

Check warning on line 91 in src/components/Reports/FinancialAccountsReport/AccountTransactions/AccountTransactionTable/AccountTransactionTable.tsx

View check run for this annotation

Codecov / codecov/patch

src/components/Reports/FinancialAccountsReport/AccountTransactions/AccountTransactionTable/AccountTransactionTable.tsx#L90-L91

Added lines #L90 - L91 were not covered by tests
};
};

Expand Down Expand Up @@ -186,7 +189,11 @@
}, [entries, currency, openingBalance, closingBalance, activeFilters]);

const Date: RenderCell = ({ row }) => (
<Typography>{dateFormatShort(row.entryDate, locale)}</Typography>
<Typography>

Check warning on line 192 in src/components/Reports/FinancialAccountsReport/AccountTransactions/AccountTransactionTable/AccountTransactionTable.tsx

View check run for this annotation

Codecov / codecov/patch

src/components/Reports/FinancialAccountsReport/AccountTransactions/AccountTransactionTable/AccountTransactionTable.tsx#L192

Added line #L192 was not covered by tests
{typeof row.entryDate === 'string'
? row.entryDate
: dateFormatShort(row.entryDate, locale)}

Check warning on line 195 in src/components/Reports/FinancialAccountsReport/AccountTransactions/AccountTransactionTable/AccountTransactionTable.tsx

View check run for this annotation

Codecov / codecov/patch

src/components/Reports/FinancialAccountsReport/AccountTransactions/AccountTransactionTable/AccountTransactionTable.tsx#L194-L195

Added lines #L194 - L195 were not covered by tests
</Typography>
);
const Category: RenderCell = ({ row }) => (
<Box>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,9 @@
];
const convertDataToArray = data.financialAccountEntries.entries.map(
(entry) => [
dateFormatShort(DateTime.fromISO(entry.entryDate), locale),
entry.entryDate
? dateFormatShort(DateTime.fromISO(entry.entryDate), locale)
: 'No entry date',

Check warning on line 125 in src/components/Reports/FinancialAccountsReport/AccountTransactions/AccountTransactions.tsx

View check run for this annotation

Codecov / codecov/patch

src/components/Reports/FinancialAccountsReport/AccountTransactions/AccountTransactions.tsx#L124-L125

Added lines #L124 - L125 were not covered by tests
entry.description ?? '',
entry.category?.name ?? entry.category?.code ?? '',
entry.type === FinancialAccountEntryTypeEnum.Debit
Expand Down
Loading