Skip to content

Commit

Permalink
fixing issue with bids_import duplication of labels - LORIS-MRI/aces#763
Browse files Browse the repository at this point in the history
  • Loading branch information
jesscall committed Feb 15, 2022
1 parent 43c1b25 commit 681d82f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
9 changes: 6 additions & 3 deletions php/annotations.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class Annotations extends \NDB_Page
];

$instance_id = $parameters['instance_id'] ?
(int) $parameters['instance_id'] : null;
intval($parameters['instance_id']) : null;
// ##################### EEGNET OVERRIDE END ################## //
$parameter_id = $parameters['parameter_id'] ?? null;

Expand All @@ -137,8 +137,11 @@ class Annotations extends \NDB_Page
if (is_null($instance_id)) {
$instance_id = $db->pselectOne(
"SELECT MAX(AnnotationInstanceID)
FROM physiological_annotation_instance",
[]
FROM physiological_annotation_instance ai
JOIN physiological_annotation_file af USING (AnnotationFileID)
WHERE PhysiologicalFileID=:physioFileID
",
['physioFileID' => $parameters['physioFileID']]
);
}

Expand Down
7 changes: 6 additions & 1 deletion php/models/electrophysioannotations.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,14 @@ class ElectrophysioAnnotations
//If the label is new, add to annotation label table
//and get label ID
$labelID = $db->pselectOne(
"SELECT AnnotationLabelID
// ##################### EEGNET OVERRIDE START ################## //
// Adding MAX here as a hack fix for now until LORIS-MRI
// bugfix for issue https://github.com/aces/Loris-MRI/issues/763
// is available and cleanup happens of the annotation_label table
"SELECT MAX(AnnotationLabelID)
FROM physiological_annotation_label
WHERE LabelName=:label",
// ##################### EEGNET OVERRIDE END ################## //
['label' => $instance_data['label_name']]
);
if (empty($labelID)) {
Expand Down

0 comments on commit 681d82f

Please # to comment.