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

output: to_csv: print header for every set of parsed fields #453

Merged
merged 1 commit into from
Feb 3, 2023

Conversation

rmilecki
Copy link
Collaborator

When parsing multiple invoices it's *incorrect* to:
1. Display header with fields names of the *first* parsed invoice
2. Display content of *all* parsed invoices

It's because parsing dfferent invoices may result in different fields.
In such case header won't make sense for all rows.

To improve handling such situations display new header for every set of
fields that differs from the last one.

@rmilecki
Copy link
Collaborator Author

This also fixes #297

@rmilecki rmilecki requested a review from bosd January 25, 2023 10:40
@rmilecki
Copy link
Collaborator Author

rmilecki commented Feb 2, 2023

Ping @bosd :)

Copy link
Collaborator

@bosd bosd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm neutral on this. (Don't use csv output) Code LGTM

@rmilecki
Copy link
Collaborator Author

rmilecki commented Feb 3, 2023

Me neither, I don't think CSV is a good fit for tree structures anyway. I just wanted to fix that issue and noticed an extra problem with doing so.

Thank you for looking at this pull request!

When parsing multiple invoices it's *incorrect* to:
1. Display header with fields names of the *first* parsed invoice
2. Display content of *all* parsed invoices

It's because parsing dfferent invoices may result in different fields.
In such case header won't make sense for all rows.

To improve handling such situations display new header for every set of
fields that differs from the last one.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
@rmilecki rmilecki merged commit 08c8993 into invoice-x:master Feb 3, 2023
@rmilecki rmilecki deleted the output-csv-improve-header branch February 3, 2023 22:35
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

2 participants