Giter Club home page Giter Club logo

Comments (8)

egh avatar egh commented on June 16, 2024 2

Thanks for the report @DamienCassou . Adding the --actual flag to the lookup in ledger seems like a very easy solution to this (thanks, @501st-alpha1). It would also be easy to add a flag to suppress the guessing of accounts.

I know the account guessing algorithm is not very good, but I'm not sure what the best way to improve it is.

from ledger-autosync.

DamienCassou avatar DamienCassou commented on June 16, 2024 1

Current workaround

--- /home/cassou/.local/venvs/ledger-autosync/lib/python3.6/site-packages/ledgerautosync/ledgerwrap.orig.py	2018-08-07 12:56:21.059177160 +0200
+++ /home/cassou/.local/venvs/ledger-autosync/lib/python3.6/site-packages/ledgerautosync/ledgerwrap.py	2018-08-07 12:53:02.225141519 +0200
@@ -80,7 +80,10 @@
     def filter_accounts(self, accts, exclude):
         accts_filtered = [a for a in accts if a != exclude]
         if accts_filtered:
-            return accts_filtered[-1]
+            pattern = re.compile("^Expenses:")
+            return next(filter(lambda account: pattern.match(account),
+                               accts_filtered),
+                        accts_filtered[-1])
         else:
             return None

from ledger-autosync.

DamienCassou avatar DamienCassou commented on June 16, 2024

Currently the matching accounts are found by asking ledger for all accounts in relation with a payee. This is a problem because ledger returns automatic postings (those that are not in the ledger file). Because ledger-autosync output is supposed to be written in the ledger file, I expect it to ignore postings that are not already written in the ledger file.

One way to solve this issue would be to look inside the ledger file instead of asking ledger to do that.

from ledger-autosync.

501st-alpha1 avatar 501st-alpha1 commented on June 16, 2024

I run into this same issue occasionally. (Due to #25 it's not very often, but once that is fixed I will probably see it more.)

This could be fixed by adding the --actual flag to the command that looks up these accounts. From the docs:

--actual
-L
    Display only actual postings, and not those created by automated transactions.

from ledger-autosync.

DamienCassou avatar DamienCassou commented on June 16, 2024

This bug still annoys me :-).

from ledger-autosync.

egh avatar egh commented on June 16, 2024

I guess #77 did not fix the issue?

from ledger-autosync.

501st-alpha1 avatar 501st-alpha1 commented on June 16, 2024

I can confirm that this still happens for me on latest master, so #77 didn't fix the issue. Looking at the PR again, it looks like the change was only made for the HLedger interface, not the raw Ledger interface (which I use) or LedgerPython.

from ledger-autosync.

501st-alpha1 avatar 501st-alpha1 commented on June 16, 2024

Opened #96 to fix the raw Ledger interface. I'm not familiar enough with the LedgerPython interface to know if / how to apply the fix there.

from ledger-autosync.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.