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

feature: support filtering by year for ultipro_google and stockplanconnect sources #31

Closed
wants to merge 1 commit into from

Conversation

jktomer
Copy link
Contributor

@jktomer jktomer commented Oct 4, 2019

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.

@coveralls
Copy link

coveralls commented Oct 4, 2019

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%
Files with Coverage Reduction New Missed Lines %
beancount_import/source/ultipro_google.py 2 0.0%
Totals Coverage Status
Change from base Build 104: -0.06%
Covered Lines: 13131
Relevant Lines: 19332

💛 - Coveralls

@jbms
Copy link
Owner

jbms commented Oct 4, 2019

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.

@jktomer
Copy link
Contributor Author

jktomer commented Oct 4, 2019

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

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 jktomer closed this Jan 8, 2024
@jktomer jktomer deleted the filter-by-year branch January 8, 2024 00:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants