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

[FR]: Implement comparability of model objects #5

Open
lmartinking opened this issue Nov 18, 2022 · 2 comments
Open

[FR]: Implement comparability of model objects #5

lmartinking opened this issue Nov 18, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@lmartinking
Copy link

Is your feature request related to a problem? Please describe.

Yes, I was running the following code:

oldtx = #... list of transactions ...
newtx = get_all_transactions(...)
newtx = [t for t in newtx if t not in oldtx]

And noticed that if you compare two different instances of the same transaction (ie: they are different instances, but representing the same transaction with the same id) they equate to False.

Describe the solution you'd like

Implement __eq__ on transaction objects. Or a more general solution could be on model objects if they have an id field.

Describe alternatives you've considered

As a workaround, I made a set of existing IDs and filter my new transaction list against those.

Additional context

No response

@lmartinking lmartinking added the enhancement New feature or request label Nov 18, 2022
@jcwillox
Copy link
Owner

Yeah I'll definitely add this, can't believe I didn't think to add that at the time 👍

@lmartinking
Copy link
Author

Thanks for your prompt response!

I realised one edge case, and that's where tags have been added to a transaction since the initial fetch (eg: via the app). I'm not sure the best way to handle this right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants