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

Fix incorrect CSV headers when exporting multiple record types #842

Merged
merged 6 commits into from May 17, 2024

Conversation

mstenta
Copy link
Member

@mstenta mstenta commented May 7, 2024

Fixes #805

This omits bundle-specific columns from CSV exports that includes entities of multiple bundles. It adds a warning message to the user to let them know this is happening.

It also adds the ability to select which bundles are included in the export via checkboxes.

Original description for posterity:

This is a quick and dirty fix. It builds the list of CSV column headers by iterating over every row to build a combined list. So the more rows you are exporting the less performant it may be.

So it fixes a bug at the expense of a new performance consideration, which is the lesser of two evils IMO. And it buys us some time to work on a better overall fix (along with some of the other feature ideas we talked about in #805).

Worth noting, one of the effects of this is that the order of columns will depend on the data, so if you export two sets of data, or if you apply different sorts to your data, you may get different column orders. But all the data will be there in the proper place.

@mstenta
Copy link
Member Author

mstenta commented May 9, 2024

I added two more commits to this.

The first checks to see if multiple bundles are being included, and if so it adds to the warning message to highlight the fact that all columns will be included and their order may vary.

Screenshot:

Screenshot from 2024-05-09 07-35-31

The second commit adds the ability to select which columns are included in the export.

Screenshots:

Screenshot 2024-05-09 at 07-35-57 Export a CSV of 2 logs Drush Site-Install

Screenshot 2024-05-09 at 07-36-06 Export a CSV of 2 logs Drush Site-Install

@mstenta mstenta force-pushed the 3.x-fix-csv-export-columns branch from 934fb5f to d236c11 Compare May 9, 2024 12:09
mstenta added a commit to mstenta/farmOS that referenced this pull request May 9, 2024
@mstenta mstenta force-pushed the 3.x-fix-csv-export-columns branch from d236c11 to 8f3f004 Compare May 9, 2024 12:10
mstenta added a commit to mstenta/farmOS that referenced this pull request May 9, 2024
mstenta added a commit to mstenta/farmOS that referenced this pull request May 9, 2024
@mstenta mstenta force-pushed the 3.x-fix-csv-export-columns branch from 8f3f004 to 8880e06 Compare May 9, 2024 19:44
@mstenta mstenta force-pushed the 3.x-fix-csv-export-columns branch from e38f7d0 to 12c3f2b Compare May 10, 2024 15:57
mstenta added a commit to mstenta/farmOS that referenced this pull request May 10, 2024
@mstenta mstenta force-pushed the 3.x-fix-csv-export-columns branch 2 times, most recently from c64c54e to f59c7fd Compare May 10, 2024 16:21
@mstenta
Copy link
Member Author

mstenta commented May 10, 2024

Unfortunately I realized that this PR only partially fixes #805. See this comment for more detail: #805 (comment)

So I pushed a commit to this PR that omits bundle-specific columns when multiple bundles are included in an export. This is a sacrifice of (currently broken) functionality, but it doesn't seem like we have a choice.

I will update the description of this PR accordingly, for future reference.

Copy link
Collaborator

@symbioquine symbioquine left a comment

Choose a reason for hiding this comment

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

LGTM

@mstenta mstenta force-pushed the 3.x-fix-csv-export-columns branch from a6c4872 to ecda35f Compare May 17, 2024 19:23
@mstenta mstenta merged commit f42fb09 into farmOS:3.x May 17, 2024
2 checks passed
@mstenta mstenta deleted the 3.x-fix-csv-export-columns branch May 17, 2024 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Export CSV on all assets/logs chooses header columns from the first asset/log in the list
3 participants