Skip to content

Commit 27a15a2

Browse files
committed
feat: add subject id to exports
1 parent fe309bc commit 27a15a2

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

apps/web/src/hooks/useInstrumentVisualization.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ export function useInstrumentVisualization({ params }: UseInstrumentVisualizatio
7474

7575
const rows = exportRecords.map((item) => {
7676
const obj: { [key: string]: any } = {};
77+
obj.subjectId = params.subjectId;
7778
for (const key of columnNames) {
7879
const val = item[key];
7980
if (key === '__date__') {
@@ -97,15 +98,20 @@ export function useInstrumentVisualization({ params }: UseInstrumentVisualizatio
9798
return csv;
9899
});
99100
break;
100-
case 'JSON':
101+
case 'JSON': {
102+
exportRecords.map((item) => {
103+
item.subjectID = params.subjectId;
104+
});
101105
void download(`${baseFilename}.json`, () => Promise.resolve(JSON.stringify(exportRecords, null, 2)));
102106
break;
107+
}
103108
case 'TSV':
104109
void download(`${baseFilename}.tsv`, () => {
105110
const columnNames = Object.keys(exportRecords[0]!);
106111

107112
const rows = exportRecords.map((item) => {
108113
const obj: { [key: string]: any } = {};
114+
obj.subjectId = params.subjectId;
109115
for (const key of columnNames) {
110116
const val = item[key];
111117
if (key === '__date__') {

0 commit comments

Comments
 (0)