rienafairefr / pynYNAB

a python client for the new YNAB
MIT License
138 stars 12 forks source link

I don't think `containsduplicate` is working #13

Closed scottrobertson closed 8 years ago

scottrobertson commented 8 years ago

Hey

I have implemented similar code from the csv import in my repo (https://github.com/scottrobertson/mondo-to-ynab) to check for duplicates. It does not seem to be working. It's allowing me to import them as many times as i want.

rienafairefr commented 8 years ago

Is the unit test test_duplicate passing in the source you have checked out ? I just verified HEAD in the master branch and it's passing the csv import duplicate tests, i.e. not importing twice.Maybe the version in pip is out of date

scottrobertson commented 8 years ago

I am using the repo directly in pip (pip install repo_url).

Does the usage look correct? https://github.com/scottrobertson/mondo-to-ynab/blob/master/python/main.py#L72-L76

rienafairefr commented 8 years ago

Usage looks fine. Considering Mondo gives you a unique id (the tx_ part), you should probably use it to ensure no duplicates, I did something similar in my OFX import script, using the FITID tag. You can probably save the mondo id in the memo of the transaction to importing into nYNAB, and not import transaction with matching data id.

If it's a webhook, mondo should be sending you only a single request per unique transaction anyway , shouldn't it ?

rienafairefr commented 8 years ago

Furthermore containsduplicate is being phased out, in favor of letting consumers (import scripts, and your code) of the library decide what is a duplicate and what's not, I think it makes more sense (how to discriminate a duplicate transaction shouldn't be tied to what's a duplicate account or whatever). I'll commit a major update soon once all the tests pass.