beancount-import icon indicating copy to clipboard operation
beancount-import copied to clipboard

feature: support filtering by year for ultipro_google and stockplanconnect sources

Open jktomer opened this issue 5 years ago • 3 comments

I organize most of my source documents by year, e.g. .../Pay Statements/2018/2018-01-02.statement.pdf or .../Amazon Invoices/2019/123-45678-9012.html.

For most sources, I can either use a recursive glob to pick up all the files in the tree, or create one Source per year, and everything works fine. But for stockplanconnect and ultipro_google, which expect to be able to translate from a transaction in the journal to a source path based only on the document ID, this doesn't work; if I use a recursive glob, every journal entry gets declared invalid because the statements don't have the expected path, and if I use one source per year-specific subdirectory, every entry ends up being declared invalid by the sources that only expect to find documents from other years.

This change allows the use of a separate source per year for directory-per-year layouts, by adding a "year" parameter to these two sources, and ignoring any journal entry from a date outside the configured year if there is one.

jktomer avatar Oct 04 '19 03:10 jktomer

Pull Request Test Coverage Report for Build 106

  • 0 of 8 (0.0%) changed or added relevant lines in 2 files are covered.
  • 2 unchanged lines in 1 file lost coverage.
  • Overall coverage decreased (-0.06%) to 65.893%

Changes Missing Coverage Covered Lines Changed/Added Lines %
beancount_import/source/stockplanconnect.py 0 4 0.0%
beancount_import/source/ultipro_google.py 0 4 0.0%
<!-- Total: 0 8
Files with Coverage Reduction New Missed Lines %
beancount_import/source/ultipro_google.py 2 0.0%
<!-- Total: 2
Totals Coverage Status
Change from base Build 104: -0.06%
Covered Lines: 13131
Relevant Lines: 19332

💛 - Coveralls

coveralls avatar Oct 04 '19 03:10 coveralls

This seems okay, though having one source per year does mean having to go through the entire transaction list for each year in certain steps. You could instead change the source to support per-year directories. Either way it is okay for now, though.

jbms avatar Oct 04 '19 04:10 jbms

I actually do like supporting per-year directories within the source a bit better; let me take a crack at that.

jktomer avatar Oct 04 '19 05:10 jktomer