The personal finance app for everyone
Sync account after transaction import (#820)
Zach Gollwitzerde53a50e4575
diff --git a/app/models/import.rb b/app/models/import.rbindex 55a33c32..c29ec6ab 100644--- a/app/models/import.rb+++ b/app/models/import.rb@@ -56,6 +56,8 @@ class Import < ApplicationRecordendend+ self.account.sync+update!(status: "complete")rescue => eupdate!(status: "failed")diff --git a/app/views/imports/_sample_table.html.erb b/app/views/imports/_sample_table.html.erbindex 83a16f5c..f4b82143 100644--- a/app/views/imports/_sample_table.html.erb+++ b/app/views/imports/_sample_table.html.erb@@ -1,22 +1,26 @@<!--TODO: Once we have more styled tables for reference, refactor and DRY this up -->-<div class="grid grid-cols-4 border border-alpha-black-200 rounded-md shadow-xs text-sm bg-white">- <div class="bg-gray-25 px-3 py-2.5 border-b border-b-alpha-black-200 font-medium rounded-tl-md">Date</div>- <div class="bg-gray-25 px-3 py-2.5 border-b border-b-alpha-black-200 font-medium">Name</div>- <div class="bg-gray-25 px-3 py-2.5 border-b border-b-alpha-black-200 font-medium">Category</div>- <div class="bg-gray-25 px-3 py-2.5 border-b border-b-alpha-black-200 font-medium rounded-tr-md">Amount</div>+<div class="grid grid-cols-5 border border-alpha-black-200 rounded-md shadow-xs text-sm bg-white">+ <div class="bg-gray-25 px-3 py-2.5 border-b border-b-alpha-black-200 font-medium rounded-tl-md">date</div>+ <div class="bg-gray-25 px-3 py-2.5 border-b border-b-alpha-black-200 font-medium">name</div>+ <div class="bg-gray-25 px-3 py-2.5 border-b border-b-alpha-black-200 font-medium">category</div>+ <div class="bg-gray-25 px-3 py-2.5 border-b border-b-alpha-black-200 font-medium">tags</div>+ <div class="bg-gray-25 px-3 py-2.5 border-b border-b-alpha-black-200 font-medium rounded-tr-md">amount</div><div class="px-3 py-2.5 border-b border-b-alpha-black-200">2024-01-01</div><div class="px-3 py-2.5 border-b border-b-alpha-black-200">Amazon</div><div class="px-3 py-2.5 border-b border-b-alpha-black-200">Shopping</div>+ <div class="px-3 py-2.5 border-b border-b-alpha-black-200">Tag1|Tag2</div><div class="px-3 py-2.5 border-b border-b-alpha-black-200">-24.99</div><div class="px-3 py-2.5 border-b border-b-alpha-black-200">2024-03-01</div><div class="px-3 py-2.5 border-b border-b-alpha-black-200">Spotify</div><div class="px-3 py-2.5 border-b border-b-alpha-black-200"></div>+ <div class="px-3 py-2.5 border-b border-b-alpha-black-200"></div><div class="px-3 py-2.5 border-b border-b-alpha-black-200">-16.32</div><div class="px-3 py-2.5 border-b border-b-alpha-black-200 rounded-bl-md">2023-01-06</div><div class="px-3 py-2.5 border-b border-b-alpha-black-200">Acme</div><div class="px-3 py-2.5 border-b border-b-alpha-black-200">Income</div>+ <div class="px-3 py-2.5 border-b border-b-alpha-black-200">Tag3</div><div class="px-3 py-2.5 border-b border-b-alpha-black-200 rounded-br-md">151.22</div></div>diff --git a/app/views/imports/load.html.erb b/app/views/imports/load.html.erbindex 68fab9b9..0565077a 100644--- a/app/views/imports/load.html.erb+++ b/app/views/imports/load.html.erb@@ -1,6 +1,6 @@<%= content_for :return_to_path, return_to_path(params, imports_path) %>-<div class="mx-auto max-w-[450px] w-full py-24 space-y-4">+<div class="mx-auto max-w-[550px] w-full py-24 space-y-4"><h1 class="sr-only"><%= t(".load_title") %></h1><div class="text-center space-y-2">@@ -30,6 +30,7 @@<ul class="list-disc text-sm pl-10"><li><%= t(".requirement1") %></li><li><%= t(".requirement2") %></li>+ <li><%= t(".requirement3") %></li></ul></div>diff --git a/config/locales/views/imports/en.yml b/config/locales/views/imports/en.ymlindex 8a089ca5..2cb90411 100644--- a/config/locales/views/imports/en.yml+++ b/config/locales/views/imports/en.yml@@ -68,6 +68,7 @@ en:requirement1: Dates must be in ISO 8601 format (YYYY-MM-DD)requirement2: Negative transaction is an "outflow" (expense), positive is an"inflow" (income)+ requirement3: Can have 0 or more tags separated by |subtitle: Import your transactionsload_csv:import_loaded: Import CSV loadeddiff --git a/test/jobs/import_job_test.rb b/test/jobs/import_job_test.rbindex 14c21339..35a0f3b5 100644--- a/test/jobs/import_job_test.rb+++ b/test/jobs/import_job_test.rb@@ -14,5 +14,6 @@ class ImportJobTest < ActiveJob::TestCaseendassert import.reload.complete?+ assert import.account.balances.present?endend