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

Sort importable files by date and account name #1687

Open
gerdemb opened this issue Sep 26, 2023 · 0 comments
Open

Sort importable files by date and account name #1687

gerdemb opened this issue Sep 26, 2023 · 0 comments

Comments

@gerdemb
Copy link

gerdemb commented Sep 26, 2023

The list of importable files on /beancount/import/ is sorted by file name. I find it much more useful if they are sorted by date and then by account name.

I added the following code to the function def import_data(self) -> list[FileImporters] in ingest.py just before the return to sort them.

        # Sort ret by the date and account attribute of infos[0] if it exists
        ret = sorted(
            ret, 
            key=lambda x: (
                x.importers[0].date is None, 
                x.importers[0].date,
                x.importers[0].account
            ) if x.importers 
            else (True, None, None)
        )
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

No branches or pull requests

1 participant