Export: an empty row in a number grid shifts all following cells left
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Anfängerfreundlichkeit
- 78/100
Rechercherichtung
Die Export-Logik liegt in lib/Service/SubmissionService.php, in der foreach-Schleife über $gridRowsPerQuestionId[$questionId]; der Zweig für leere Zeilen hängt derzeit eine einzelne ''-Spalte an. Prüfe, wie $gridColumnsPerQuestionId für ANSWER_GRID_TYPE_NUMBER aufgebaut wird, und sorge dafür, dass eine leere Zeile pro Spalte eine leere Zelle hinzufügt. Ändere außerdem die innere empty()-Prüfung, sodass eine Antwort von 0 erhalten bleibt. Fertig, wenn ein Number-Grid mit einer leeren Zeile die späteren Spalten ausgerichtet lässt und eine Antwort von 0 als 0 exportiert wird.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Describe the bug
In the CSV/XLSX export of results, a number grid question whose row is left completely empty shifts every following cell on that line to the left: the next rows' values, and the answers to all later questions, end up under the wrong headers.
Steps to reproduce
- Create a form with one grid question, cell type Number, rows A1, A2, A3 and columns N0, N1, N2. Add a second question of any type after it.
- Submit one response that fills A1 (N0 = 2, N2 = 1) and A3 (N1 = 4), and leaves all of row A2 empty.
- Go to Results and export to CSV or XLSX.
Expected behaviour
The 4 appears under "(A3 - N1)", and the second question's answer appears in its own column.
Actual behaviour
The 4 appears under "(A2 - N2)", and every later cell on that line, including the second question's answer, is shifted left by (number of columns − 1) = 2.
Cause
In lib/Service/SubmissionService.php (the export), a grid row with no answer adds one empty cell:
foreach ($gridRowsPerQuestionId[$questionId] as $row) {
if (empty($answerText[$row])) {
$columns[] = '';
continue;
}
A number grid has one export column per row × column, so for ANSWER_GRID_TYPE_NUMBER an empty row has to add one empty cell per column (count($gridColumnsPerQuestionId[$questionId])). Radio and checkbox grids use one column per row, so they are not affected.
Versions
Seen on Forms 5.4.2; the same code is on main today (checked against v5.4.3 and main).
Related, same block: an answer of 0 exports as an empty cell
For number grids, the inner check if (empty($answerText[$row][$column])) treats an answer of 0 (or "0") as missing, because empty() is true for 0 in PHP, so a cell answered with 0 is exported blank. A check such as !isset($answerText[$row][$column]) || $answerText[$row][$column] === '' keeps the 0. (Found by reading the code, not by running it.)
- Vorherrschende Sprache
- JavaScript
- Sterne
- 385
- Forks
- 133
- Ø Merge
- 7 Std. 54 Min.
- Gemergte PRs (30 T.)
- 157
Entwicklungsumgebung
Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus nextcloud/forms
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
Maintainer antworten meist innerhalb von 1 Tag
-
0. Needs triage bug
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 64/100
Maintainer antworten meist innerhalb von 1 Tag
-
1. to develop enhancement
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 35/100
nextcloud/forms#3841 · 1 Reaktion ·
Maintainer antworten meist innerhalb von 1 Tag
-
0. Needs triage bug
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 45/100
nextcloud/forms#3831 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
1. to develop enhancement
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 22/100
nextcloud/forms#3829 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in nextcloud/forms
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
cytoscape/cytoscape.js#3597 ·
Maintainer antworten meist innerhalb von 5 Tagen
-
priority: low server testing
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 88/100
blamechris/chroxy#9277 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 72/100
sunososobro-hub/cloudball#191 ·
Maintainer antworten meist innerhalb von 1 Tag
-
[MCP]: page snapshots in .playwright-mcp/ are not git-ignored (.playwright-cli/ is, since #42318)Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
microsoft/playwright#44289 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Wire ISO post: has() accepts text values such as an empty string, true or 0x1A for wire numbersOffenarea:post effort:low enhancement P7 source:agent
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
Maintainer antworten meist innerhalb von 1 Tag