actual icon indicating copy to clipboard operation
actual copied to clipboard

[Bug]: API import transactions overrides some fields, not others, hard to make sense

Open cpainchaud opened this issue 1 year ago • 1 comments

Verified issue does not already exist?

  • [X] I have searched and found no existing issue

What happened?

when using API to import transactions, if they already exist (same imported_id) then an odd behavior happens:

  • if the 'updated' transaction has changed amount, it will not take it in account and keep the old one
  • if the 'updated' transaction has changed the 'cleared' status, it will use that new status. ommiting the status will force it to True

I do believe it should be the contrary:

  • there are good reason to update an amount and it should not be ignored by the import call
  • 'Cleared' should not be touched, it's what people use to check operations was reviewed.

selfhosted fresh v23.10.0 servers and client. API version 6.2.1

What error did you receive?

no error in particular

Where are you hosting Actual?

Docker

What browsers are you seeing the problem on?

Chrome, Other

Operating System

Windows 10

cpainchaud avatar Oct 26 '23 12:10 cpainchaud

Here is another perspective: depending on what your import source is, it may actually be the source of truth, including whether the transaction is cleared or not.

But I agree with you that the current behavior is non-intuitive. Here is what I think would make some sense, from what I could see:

  1. an additional boolean argument to the import API that overwrites the existing data with whatever new data is provided (if true and if there is a matching imported_id, of course)
  2. now that a "reconciled" flag was introduced, ensure that no import call touches any transaction field (unless using the flag I suggested above)

My goal with (1) is being able to rewrite my importers to fine-tune some inferred notes/payees/categories and not have to manually delete the previously importer transactions for that.

(2) is about an issue I just found, where I had to manually fix some transaction dates for imported transactions, only to have them overwritten again by the next import, even though they were already reconciled.

tavlima avatar Dec 17 '23 20:12 tavlima