Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EEG] Electrodes query and file download fix #8478

Merged
merged 3 commits into from
Mar 28, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ class DownloadPanel extends Component {
: '/mri/jiv/get_file.php?file=' + download.file
}
target='_blank'
download
style={{
margin: 0,
}}
Expand Down
26 changes: 24 additions & 2 deletions modules/electrophysiology_browser/php/sessions.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ class Sessions extends \NDB_Page
$params['SID'] = $this->sessionID;
$query = 'SELECT
pf.PhysiologicalFileID
FROM
FROM
physiological_file pf ';

if ($outputType != 'all_types') {
Expand Down Expand Up @@ -583,7 +583,6 @@ class Sessions extends \NDB_Page
// Metadata

$queries = [
'physiological_electrode' => 'physiological_electrode_file',
'physiological_channel' => 'physiological_channel_file',
'physiological_event_archive' => 'physiological_event_files',
'physiological_annotation_archive' => 'physiological_annotation_files',
Expand Down Expand Up @@ -616,6 +615,7 @@ class Sessions extends \NDB_Page
$query_statement,
['PFID' => $physioFileID]
);

if ($query_statement) {
$downloadLinks[$query_value] = [
'file' => $query_statement['FilePath'],
Expand All @@ -629,6 +629,28 @@ class Sessions extends \NDB_Page
}
}

// Electrodes
$file_name = 'physiological_electrode_file';
// TODO: If we plan to support multiple electrode spaces
// the LIMIT logic should be revisited
$query_statement = "SELECT DISTINCT(FilePath)
FROM physiological_electrode
JOIN physiological_coord_system_electrode_rel
USING (PhysiologicalElectrodeID)
WHERE PhysiologicalFileID=:PFID
LIMIT 1";
$query_statement = $db->pselect(
$query_statement,
['PFID' => $physioFileID]
);

$downloadLinks[$file_name] = [
'file' => '',
'label' => $labels[$file_name],
];
if (count($query_statement) > 0) {
$downloadLinks[$file_name]['file'] = $query_statement[0]['FilePath'];
}
return $downloadLinks;
}

Expand Down