Skip to content

Commit

Permalink
[imaging_browser] Use the tblScanTypes config setting to determine if…
Browse files Browse the repository at this point in the history
… a session has new content (#2912)

Use the tblScanTypes config setting to determine if a session has new content to QC.
  • Loading branch information
gluneau authored and driusan committed Aug 30, 2017
1 parent f989485 commit f1ee1be
Showing 1 changed file with 27 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,30 @@ class NDB_Menu_Filter_Imaging_Browser extends NDB_Menu_Filter
)
);

if (!empty($scan_id_types)) {
$this->acqpid = "AND AcquisitionProtocolID IN (".
implode(",", array_keys($scan_id_types)) .")";
$isFirst = true;
foreach ($scan_id_types as $key => $value) {
if ($isFirst) {
$acqpif = "IF(FIND_IN_SET({$key},GROUP_CONCAT(
DISTINCT AcquisitionProtocolID))>0 ";
} else {
$acqpif .= "OR FIND_IN_SET({$key},GROUP_CONCAT(
DISTINCT AcquisitionProtocolID))>0 ";
}
$isFirst = false;
}
$acqpif .= ",'new','')";
} else {
$this->acqpid = '';
$acqpif = "'new'";
}

$NewDataSubquery = "CASE
COALESCE(nd.QCLastChangeTime, 'new')
WHEN 'new' THEN 'new'
WHEN '' THEN 'new'
COALESCE(Max(fqc.QCLastChangeTime), 'new')
WHEN 'new' THEN {$acqpif}
WHEN '' THEN {$acqpif}
ELSE ''
END";

Expand Down Expand Up @@ -122,13 +142,7 @@ class NDB_Menu_Filter_Imaging_Browser extends NDB_Menu_Filter
JOIN candidate c ON (c.CandID=s.CandID)
JOIN files f ON (f.SessionID=s.ID)
LEFT JOIN files_qcstatus fqc ON (fqc.FileID=f.FileID)
JOIN mri_acquisition_dates md ON (md.SessionID=s.ID)
LEFT JOIN (SELECT files.SessionID, MIN(QCLastChangeTime)
as QCLastChangeTime FROM files
LEFT JOIN files_qcstatus USING (FileID)
WHERE OutputType='native' AND AcquisitionProtocolID
NOT IN (1, 2, 3, 52) GROUP BY files.SessionID) nd
ON (nd.SessionID=f.SessionID) ";
JOIN mri_acquisition_dates md ON (md.SessionID=s.ID)";

$left_joins = "";
foreach ($case_desc as $key => $value) {
Expand All @@ -147,8 +161,7 @@ class NDB_Menu_Filter_Imaging_Browser extends NDB_Menu_Filter
WHERE
s.Active = 'Y' AND
f.PendingStaging=0 AND
f.FileType='mnc' AND
f.AcquisitionProtocolID not in (1, 2, 3, 52)";
f.FileType='mnc'";

$this->query .= $left_joins;
$this->query .= $where;
Expand Down Expand Up @@ -448,11 +461,11 @@ class NDB_Menu_Filter_Imaging_Browser extends NDB_Menu_Filter
$query .= " AND s.MRIQCPending='Y'";
break;
case "N":
$query .= " AND fqc.QCFirstChangeTime IS NULL";
$query .= " AND fqc.QCFirstChangeTime IS NULL " . $this->acqpid;
break;
case "PN":
$query .= " AND (s.MRIQCPending='Y'
OR fqc.QCFirstChangeTime IS NULL)";
OR (fqc.QCFirstChangeTime IS NULL ". $this->acqpid ."))";
break;
}
} else if ($field == 'AcquisitionProtocolID') {
Expand Down

0 comments on commit f1ee1be

Please sign in to comment.