fix(cpn): google earth export#7384
Conversation
📝 WalkthroughWalkthroughThe KML export now scans the CSV header to find ChangesDynamic column detection for KML export
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@companion/src/logsdialog.cpp`:
- Around line 349-355: The current loop in Logsdialog (around the incExtraData
block) matches selected extra fields by header text which breaks when headers
are duplicated; instead, store the original CSV column index on each
QTableWidgetItem (e.g., using item->setData(originalIndex, Qt::UserRole) when
populating ui->FieldsTW) and here read that back
(item->data(Qt::UserRole).toInt()) to push into extradataCols; keep the existing
selection check (item->isSelected()) but replace the DisplayRole comparison with
reading the stored original index and append that index to extradataCols so
selection is resolved by column index not by header text.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: cbe1c65e-15b6-4c34-9ca2-6cffa456c65c
📒 Files selected for processing (1)
companion/src/logsdialog.cpp
| if (incExtraData) { | ||
| for (int j = 0; j < ui->FieldsTW->rowCount(); j++) { | ||
| if (ui->FieldsTW->item(j, 0) && ui->FieldsTW->item(j, 0)->isSelected() && | ||
| ui->FieldsTW->item(j, 0)->data(Qt::DisplayRole).toString() == dataPoints.at(0).at(i)) { | ||
| extradataCols << i; // save data index not selection list index | ||
| } | ||
| } |
There was a problem hiding this comment.
Preserve extra-field identity by column index, not header text.
Line 352 resolves selected extras by display text only. If a log has duplicate column labels, selecting one row here will add every matching header to extradataCols, so the KML schema/data can include unintended fields. Store the original CSV column index on each FieldsTW item and read that back here instead of re-matching by name.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@companion/src/logsdialog.cpp` around lines 349 - 355, The current loop in
Logsdialog (around the incExtraData block) matches selected extra fields by
header text which breaks when headers are duplicated; instead, store the
original CSV column index on each QTableWidgetItem (e.g., using
item->setData(originalIndex, Qt::UserRole) when populating ui->FieldsTW) and
here read that back (item->data(Qt::UserRole).toInt()) to push into
extradataCols; keep the existing selection check (item->isSelected()) but
replace the DisplayRole comparison with reading the stored original index and
append that index to extradataCols so selection is resolved by column index not
by header text.
Fixes #7381
Summary of changes:
Summary by CodeRabbit