Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/store/report/thunks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,9 @@ const fetchTsxReport = async (
: args.columns.map((col, index) => ({
index,
key: col.key,
visible: col.defaultHidden === true ? false : true,
visible: col.defaultHidden !== true,
}));
colStates = colStates
.filter(({ visible }) => !!visible)
.map((column) => (column.key === 'study' ? { ...column, key: 'study.study_code' } : column));
colStates = colStates.filter(({ visible }) => !!visible);

const columnKeyOrdered = [...colStates].sort((a, b) => a.index - b.index).map(({ key }) => key);
const tsvColumnsConfig = data!.data[args.index].columnsState.state.columns.filter(({ field }) =>
Expand Down Expand Up @@ -259,11 +257,13 @@ const fetchTsxReport = async (
};

const getTitleFromColumns = (columns: ProColumnType[], field: string) => {
const fieldToUse = field === 'study.study_code' ? 'study' : field;
let column = columns.find(({ key }) => key === field);

const column = columns.find(({ key }) => key === fieldToUse);
if (!column && field === 'study') {
column = columns.find(({ key }) => key === 'study.study_code');
}

if (!column || (column.title && typeof column.title !== 'string')) {
if (!column?.title) {
return startCase(field.replace(/\./g, ' '));
}

Expand Down