Repository navigation
fix(export): keep cells under their headers for empty grid and ranking answers - #4001
Merged
Merged
Conversation
…g answers The export writes one column per row of a grid, per row and column of a number grid and per option of a ranking. Three cases wrote fewer cells than the header has columns, so every later cell on the line, including the answers to all following questions, moved left: - a number grid row left completely empty wrote one cell instead of one per column, - a grid or ranking question left unanswered wrote one cell instead of one per export column. Also, a number grid cell answered with 0 was exported empty, because empty() treats 0 as missing. Fixes #3980 Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
Member
Author
|
/backport to stable5.4 |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Chartman123
approved these changes
Nov 23, 2026
Merged
3 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The CSV/XLSX export (and the linked spreadsheet) writes one column per row of a grid question, one per row and column of a number grid, and one per option of a ranking question. In three cases it wrote fewer cells than the header has columns, so every later cell on that line, including the answers to all following questions, ended up under the wrong header:
In addition, a number grid cell answered with 0 was exported as an empty cell, because
empty()treats 0 as missing.Fixes #3980
Change
SubmissionService::getSubmissionsData()now knows how many export columns each grid and ranking question has and writes that many empty cells for a missing answer, an empty number grid row writes one empty cell per column, and a number grid cell is only empty when no value is stored, so 0 is kept. The XLSX export and the linked file sync use the same data, so they are fixed as well.How to verify
Four new cases in
SubmissionServiceTest::testGetSubmissionsDatacover these situations, each with a question after the grid or ranking so a shift is visible; all four fail without the fix. The existingranking-unansweredcase did not catch the shift because the ranking was the last question, where the missing cells are not noticeable.Reproduced on a Nextcloud 36 development instance before the fix.
🤖 AI (if applicable)