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

Fix bug where transactions were duplicated in import confirm #941

Conversation

ljhurst
Copy link
Contributor

@ljhurst ljhurst commented Jul 3, 2024

What

When reviewing imported transactions on the confirm page, transactions were duplicated for every date in the CSV. This was a view issue only. Clicking import imported the correct number of transactions

http://0.0.0.0:3000/imports/edc55bb1-0fcb-460d-b26b-dfb263728e55/confirm

Example CSV data

date,name,category,amount
2024-07-01,McDonalds,Food & Drink, -10
2024-06-30,Delta,Travel, -100
2024-06-30,Lyft,Auto & Transport, -5

Before
Screenshot 2024-07-03 at 00 21 03

How

  • Use grouped transactions instead of all transaction_entries

Validation

After
Screenshot 2024-07-03 at 00 20 33

Signed-off-by: Luke Hurst <hurstlj@umich.edu>
@ljhurst ljhurst marked this pull request as ready for review July 3, 2024 07:43
Copy link
Collaborator

@zachgoll zachgoll left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch and thanks for the fix!

Would you mind also adding this line into the import test so we can make sure this one doesn't come back?

diff --git a/test/system/imports_test.rb b/test/system/imports_test.rb
index b9ee4f8..98f9614 100644
--- a/test/system/imports_test.rb
+++ b/test/system/imports_test.rb
@@ -89,6 +89,7 @@ class ImportsTest < ApplicationSystemTestCase
 
     # 5) Confirm step
     assert_selector "h1", text: "Confirm import"
+    assert_selector "#new_account_entry", count: 2
     click_button "Import 2 transactions"
     assert_selector "h1", text: "Imports"
   end

Signed-off-by: Luke Hurst <hurstlj@umich.edu>
@ljhurst
Copy link
Contributor Author

ljhurst commented Jul 3, 2024

Added!

@ljhurst ljhurst requested a review from zachgoll July 3, 2024 20:46
@zachgoll zachgoll merged commit cf23453 into maybe-finance:main Jul 3, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants