Skip to content

Commit

Permalink
[API] In \project dicoms endpoints: Corrected travis errors
Browse files Browse the repository at this point in the history
  • Loading branch information
spell00 committed Nov 4, 2020
1 parent 26ef029 commit 97beb63
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 60 deletions.
36 changes: 18 additions & 18 deletions modules/api/php/endpoints/project/project.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -101,24 +101,24 @@ class Project extends Endpoint implements \LORIS\Middleware\ETagCalculator
// Delegate to sub-endpoints
$subendpoint = array_shift($pathparts);
switch($subendpoint) {
case 'candidates':
$handler = new Candidates($this->_project);
break;
case 'images':
$handler = new Images($this->_project);
break;
case 'instruments':
$handler = new Instruments($this->_project);
break;
case 'visits':
$handler = new Visits($this->_project);
break;
case 'recordings':
$handler = new Recordings($this->_project);
break;
case 'dicoms':
$handler = new Dicoms($this->_project);
break;
case 'candidates':
$handler = new Candidates($this->_project);
break;
case 'images':
$handler = new Images($this->_project);
break;
case 'instruments':
$handler = new Instruments($this->_project);
break;
case 'visits':
$handler = new Visits($this->_project);
break;
case 'recordings':
$handler = new Recordings($this->_project);
break;
case 'dicoms':
$handler = new Dicoms($this->_project);
break;
default:
return new \LORIS\Http\Response\JSON\NotFound();
}
Expand Down
77 changes: 36 additions & 41 deletions modules/api/php/models/projectdicomsrow.class.inc
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,10 @@ class ProjectDicomsRow implements \LORIS\Data\DataInstance
private $_scantype;
private $_qcstatus;
private $_selected;
/**
* @var mixed|null
*/
private $_tarname;
/**
* @var mixed|null
*/
private $_dicomarchiveid;
private $_source;
private $_archive;

/**
* Create a new ProjectDicomsRow
Expand All @@ -49,21 +45,21 @@ class ProjectDicomsRow implements \LORIS\Data\DataInstance
*/
public function __construct(array $row)
{
$this->_candid = $row['Candidate'] ?? null;
$this->_pscid = $row['PSCID'] ?? null;
$this->_entitytype = $row['Entity_type'] ?? null;
$this->_visitlabel = $row['Visit'] ?? null;
$this->_visitdate = $row['Visit_date'] ?? null;
$this->_centerid = $row['CenterID'] ?? null;
$this->_centername = $row['Site'] ?? null;
$this->_tarname = $row['tarchiveid'] ?? null;
$this->_dicomarchiveid = $row['DicomArchiveID'] ?? null;
$this->_source = $row['Source'] ?? null;
$this->_archive = $row['Archive'] ?? null;
$this->_inserttime = $row['InsertTime'] ?? null;
$this->_scantype = $row['ScanType'] ?? null;
$this->_qcstatus = $row['QC_status'] ?? null;
$this->_selected = $row['Selected'] ?? null;
$this->_candid = $row['Candidate'] ?? null;
$this->_pscid = $row['PSCID'] ?? null;
$this->_entitytype = $row['Entity_type'] ?? null;
$this->_visitlabel = $row['Visit'] ?? null;
$this->_visitdate = $row['Visit_date'] ?? null;
$this->_centerid = $row['CenterID'] ?? null;
$this->_centername = $row['Site'] ?? null;
$this->_tarname = $row['tarchiveid'] ?? null;
$this->_dicomarchiveid = $row['DicomArchiveID'] ?? null;
$this->_source = $row['Source'] ?? null;
$this->_archive = $row['Archive'] ?? null;
$this->_inserttime = $row['InsertTime'] ?? null;
$this->_scantype = $row['ScanType'] ?? null;
$this->_qcstatus = $row['QC_status'] ?? null;
$this->_selected = $row['Selected'] ?? null;
}

/**
Expand All @@ -73,27 +69,26 @@ class ProjectDicomsRow implements \LORIS\Data\DataInstance
*/
public function toJSON() : string
{
$obj = [
'Candidate' => $this->_candid,
'PSCID' => $this->_pscid,
'Visit' => $this->_visitlabel,
'Visit_date' => $this->_visitdate,
'Site' => $this->_centername,
'InsertTime' => $this->_inserttime,
'ScanType' => $this->_scantype,
'QC_status' => $this->_qcstatus,
'Selected' => $this->_selected,
'TarchiveID' => $this->_tarname,
'Source' => $this->_source,
'Archive' => $this->_archive,
'DicomArchiveID' => $this->_dicomarchiveid
$obj = [
'Candidate' => $this->_candid,
'PSCID' => $this->_pscid,
'Visit' => $this->_visitlabel,
'Visit_date' => $this->_visitdate,
'Site' => $this->_centername,
'InsertTime' => $this->_inserttime,
'ScanType' => $this->_scantype,
'QC_status' => $this->_qcstatus,
'Selected' => $this->_selected,
'TarchiveID' => $this->_tarname,
'Source' => $this->_source,
'Archive' => $this->_archive,
'DicomArchiveID' => $this->_dicomarchiveid
];
$filename = explode('/', $this->_archive)[1];
$candid = $obj['Candidate'];
$visit = $obj['Visit'];

$obj['tarname'] = $filename;
$obj['Path'] = "/candidates/$candid/$visit/dicoms/$filename";
$filename = explode('/', $this->_archive)[1];
$candid = $obj['Candidate'];
$visit = $obj['Visit'];
$obj['tarname'] = $filename;
$obj['Path'] = "/candidates/$candid/$visit/dicoms/$filename";
$obj['InsertTime'] = date('c', (int) $obj['InsertTime']);

return json_encode($obj);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class ProjectDicomsRowProvisioner extends DBRowProvisioner
*/
function __construct(\Project $project, \DateTime $since)
{
parent::__construct(
parent::__construct(
'
SELECT
s.CandID as Candidate,
Expand Down

0 comments on commit 97beb63

Please sign in to comment.