Export: an empty row in a number grid shifts all following cells left
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
エクスポート処理は lib/Service/SubmissionService.php の $gridRowsPerQuestionId[$questionId] に対する foreach ループ内にあります。空行の分岐は現在 '' の列を1つ追加するだけです。ANSWER_GRID_TYPE_NUMBER に対して $gridColumnsPerQuestionId がどのように構築されるかを確認し、空行が列ごとに空のセルを1つ追加するようにしてください。また、内側の empty() チェックを変更し、0 の回答が保持されるようにしてください。空行を含む number グリッドで後続の列の位置がずれず、0 の回答が 0 としてエクスポートされれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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.)
- 主要言語
- JavaScript
- スター
- 385
- フォーク
- 133
- 平均マージ
- 7時間 54分
- マージ済み PR(30日)
- 157
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
nextcloud/forms のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
0. Needs triage bug
難易度 3/5 1〜2日 初心者へのやさしさ 64/100
メンテナーはふだん 1 日以内に返信
-
1. to develop enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
nextcloud/forms#3841 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
0. Needs triage bug
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
nextcloud/forms#3831 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
1. to develop enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 22/100
nextcloud/forms#3829 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
nextcloud/forms の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
cytoscape/cytoscape.js#3597 ·
メンテナーはふだん 5 日以内に返信
-
priority: low server testing
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
blamechris/chroxy#9277 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 72/100
sunososobro-hub/cloudball#191 ·
メンテナーはふだん 1 日以内に返信
-
[MCP]: page snapshots in .playwright-mcp/ are not git-ignored (.playwright-cli/ is, since #42318)オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
microsoft/playwright#44289 ·
メンテナーはふだん 1 日以内に返信
-
Wire ISO post: has() accepts text values such as an empty string, true or 0x1A for wire numbersオープンarea:post effort:low enhancement P7 source:agent
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信