Skip to content

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

Merged
rmilecki merged 1 commit intoinvoice-x:masterfrom
rmilecki:output-csv-improve-header
Feb 3, 2023
Merged

output: to_csv: print header for every set of parsed fields#453
rmilecki merged 1 commit intoinvoice-x:masterfrom
rmilecki:output-csv-improve-header

Conversation

@rmilecki
Copy link
Copy Markdown
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
Copy Markdown
Collaborator Author

This also fixes #297

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

rmilecki commented Feb 2, 2023

Ping @bosd :)

Copy link
Copy Markdown
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
Copy Markdown
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 force-pushed the output-csv-improve-header branch from 8ff5d5b to 4de4445 Compare February 3, 2023 22:30
@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.

2 participants