Skip to content

Commit a653911

Browse files
authored
fix(data table): correct order of NLP columns DEV-1291 (#6478)
### 📣 Summary Corrects sorting of data table columns to ensure NLP/QA supplemental data is placed after relevant questions.
1 parent 18c9646 commit a653911

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

jsapp/js/components/submissions/table.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -754,10 +754,11 @@ export class DataTable extends React.Component<DataTableProps, DataTableState> {
754754

755755
// Detect supplemental details column and put it after its source column.
756756
if (q === undefined && key.startsWith(SUPPLEMENTAL_DETAILS_PROP)) {
757-
const supplementalColumnSource = key.split('/')[1]
758-
// Add extra step for grouped items
759-
const sourceCleaned = supplementalColumnSource.replace(/-/g, '/').split('/').at(-1) || ''
760-
const sourceColumn = columnsToRender.find((column) => column.id === flatPaths[sourceCleaned])
757+
const keyArray = key.split('/')
758+
const relatedKey = keyArray.at(-2)
759+
const sourceColumn = relatedKey
760+
? columnsToRender.find((column) => column.id === flatPaths[relatedKey])
761+
: undefined
761762
if (sourceColumn) {
762763
// This way if we have a source column with index `2`, and
763764
// the supplemental column with index `5`, we will set

0 commit comments

Comments
 (0)