Skip to content
This repository has been archived by the owner on Nov 5, 2024. It is now read-only.

Commit

Permalink
Fix CSVImporterV2.kt bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
ILIYANGERMANOV committed Apr 15, 2023
1 parent 425b7d4 commit 9dba460
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions app/src/main/java/com/ivy/wallet/ui/csv/domain/CSVImporterV2.kt
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,16 @@ class CSVImporterV2 @Inject constructor(
val toAccount = if (type == TransactionType.TRANSFER) {
mapAccount(
baseCurrency = baseCurrency,
accountNameString = parseAccount(
accountNameString = parseToAccount(
value = row.extractValue(transferFields.toAccount),
metadata = transferFields.toAccount.metadata
),
currencyRawString = parseAccountCurrency(
currencyRawString = parseToAccountCurrency(
value = row.extractValue(transferFields.toAccountCurrency),
metadata = transferFields.toAccountCurrency.metadata
) ?: parseAccountCurrency(
value = row.extractValue(importantFields.accountCurrency),
metadata = importantFields.accountCurrency.metadata,
),
color = null,
icon = null,
Expand Down Expand Up @@ -161,12 +164,7 @@ class CSVImporterV2 @Inject constructor(
val dateTime = parseDate(
row.extractValue(importantFields.date),
importantFields.date.metadata
)
val dueDate = null
if (dateTime == null) {
//Cannot save transactions without any date
return null
}
) ?: return null

val account = mapAccount(
baseCurrency = baseCurrency,
Expand Down Expand Up @@ -209,7 +207,7 @@ class CSVImporterV2 @Inject constructor(
toAccountId = toAccount?.id,
toAmount = toAmount?.toBigDecimal() ?: amount.toBigDecimal(),
dateTime = dateTime,
dueDate = dueDate,
dueDate = null,
categoryId = category?.id,
title = title,
description = description
Expand Down

0 comments on commit 9dba460

Please sign in to comment.