[GNC-dev] Online ID matching for OFX import
jralls at ceridwen.us
Sun Jan 5 19:46:32 EST 2020
> On Jan 5, 2020, at 2:01 PM, Christian Stimming <christian at cstimming.de> wrote:
> Am Sonntag, 5. Januar 2020, 22:39:58 CET schrieb Mike Alexander:
>> I agree that running the search twice is probably ok. However, John
>> raises another point which seems relevant. What if there is more than
>> one partial match? Right now it returns the first one. It would seem
>> better to punt if there is no full match and more than one partial
> Oh well. I don't think we should complicate this a lot more. If there is a
> wrong match, currently we don't have any GUI possibility for the user to fix
> this anyway. We point the user to editing the XML file, unfortunately.
> Hence, the case with multiple matches, either by complete match or by partial,
> is unsolved anyway currently. Just take the first and that's it... The real
> solution would be to have a dialog window showing all online_ids, with
> sorting, searching, editing and so on. As long as nobody volunteers to add
> such a thing, just use the first match.
Complexity is not a valid reason to reject a solution to a complex problem unless there's a simpler solution that solves it *just as well*. Hackish solutions--and I'm just as guilty on that front as I wrote the strncmp hack--are far more likely to trip us up again and again every time someone else pops up with another use case. Piling up hacks creates technical debt: we're already going through the account list twice because of an another hack for a libofx peculiarity. We need to work out a correct general solution that doesn't pile up more technical debt. We have quite enough of that already.
Whether the user can do something about it or not it saves us work on a support email or bug report later if we at least log that we couldn't match because the online account number has multiple matches.
You're right about the list, the allocations would be expensive and pointless since we can't do anything with it. All we need is an Account* for the first partial match and either an int to count the partials (for the error message) or a gboolean to record that we had more than one partial.
We can promote Daniel Ditman's create_online_id to import-utilities and add stripping the space there then use it everywhere we're creating an online id and avoid that pass as well. I've started on this already, I'll have a PR tomorrow sometime.
More information about the gnucash-devel