mirror of
https://github.com/maybe-finance/maybe.git
synced 2025-07-24 07:39:39 +02:00
feat(import): add currency and number format support for CSV imports (#1819)
* feat(import): add currency and number format support for CSV imports * feat(import): add currency and format for mint and trade * fix(imports): remove currency field in favor of currency csv col * fix(imports): remove validate column from import model * test(import): add some tests for imports * test(import): add some tests for generate_rows_from_csv * fix: change method name for import model * fix: change before validation --------- Co-authored-by: danestves <danestves@users.noreply.github.com>
This commit is contained in:
parent
9e5f1574bc
commit
077694bbde
9 changed files with 307 additions and 13 deletions
|
@ -28,14 +28,19 @@ class TransactionImportTest < ActiveSupport::TestCase
|
|||
end
|
||||
|
||||
test "imports transactions, categories, tags, and accounts" do
|
||||
import = <<-CSV
|
||||
import = <<~CSV
|
||||
date,name,amount,category,tags,account,notes
|
||||
01/01/2024,Txn1,100,TestCategory1,TestTag1,TestAccount1,notes1
|
||||
01/02/2024,Txn2,200,TestCategory2,TestTag1|TestTag2,TestAccount2,notes2
|
||||
01/03/2024,Txn3,300,,,,notes3
|
||||
CSV
|
||||
|
||||
@import.update!(raw_file_str: import)
|
||||
@import.update!(
|
||||
raw_file_str: import,
|
||||
date_col_label: "date",
|
||||
amount_col_label: "amount",
|
||||
date_format: "%m/%d/%Y"
|
||||
)
|
||||
|
||||
@import.generate_rows_from_csv
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue