}
$where = Database::getWhere($criteria, true);
$sql = 'SELECT DISTINCT
- sres.fileset, sres.client, sres.job, ores.starttime, ores.jobid, jres.jobstatus
+ sres.fileset, sres.client, sres.job, jres.starttime, jres.endtime, ores.jobid, jres.jobstatus
FROM Job AS jres,
(
SELECT DISTINCT
JOIN Client USING (ClientId)
) AS sres, (
SELECT
- MAX(StartTime) AS starttime,
MAX(JobId) AS jobid,
FileSet.FileSet AS fileset,
Client.Name AS client,
AND sres.fileset = ores.fileset
AND jres.Type = \'B\'
' . (!empty($where['where']) ? ' AND ' . $where['where'] : '') . '
- ORDER BY sres.fileset ASC, sres.client ASC, sres.job ASC, ores.starttime ASC ' . $limit;
+ ORDER BY sres.fileset ASC, sres.client ASC, sres.job ASC, jres.starttime ASC ' . $limit;
$connection = SourceRecord::finder()->getDbConnection();
$connection->setActive(true);
$fileset = $this->Request->contains('fileset') && $misc->isValidName($this->Request['fileset']) ? $this->Request['fileset'] : '';
$starttime_from = $this->Request->contains('starttime_from') && $misc->isValidInteger($this->Request['starttime_from']) ? (int)$this->Request['starttime_from'] : null;
$starttime_to = $this->Request->contains('starttime_to') && $misc->isValidInteger($this->Request['starttime_to']) ? (int)$this->Request['starttime_to'] : null;
+ $endtime_from = $this->Request->contains('endtime_from') && $misc->isValidInteger($this->Request['endtime_from']) ? (int)$this->Request['endtime_from'] : null;
+ $endtime_to = $this->Request->contains('endtime_to') && $misc->isValidInteger($this->Request['endtime_to']) ? (int)$this->Request['endtime_to'] : null;
$jobstatus = $this->Request->contains('jobstatus') && $misc->isValidState($this->Request['jobstatus']) ? $this->Request['jobstatus'] : '';
$hasobject = $this->Request->contains('hasobject') && $misc->isValidBoolean($this->Request['hasobject']) ? $this->Request['hasobject'] : null;
// Start time range
if (!empty($starttime_from) || !empty($starttime_to)) {
- $params['ores.starttime'] = [];
+ $params['jres.starttime'] = [];
if (!empty($starttime_from)) {
- $params['ores.starttime'][] = [
+ $params['jres.starttime'][] = [
'operator' => '>=',
'vals' => date('Y-m-d H:i:s', $starttime_from)
];
}
if (!empty($starttime_to)) {
- $params['ores.starttime'][] = [
+ $params['jres.starttime'][] = [
'operator' => '<=',
'vals' => date('Y-m-d H:i:s', $starttime_to)
];
}
}
+ // End time range
+ if (!empty($endtime_from) || !empty($endtime_to)) {
+ $params['jres.endtime'] = [];
+ if (!empty($endtime_from)) {
+ $params['jres.endtime'][] = [
+ 'operator' => '>=',
+ 'vals' => date('Y-m-d H:i:s', $endtime_from)
+ ];
+ }
+ if (!empty($endtime_to)) {
+ $params['jres.endtime'][] = [
+ 'operator' => '<=',
+ 'vals' => date('Y-m-d H:i:s', $endtime_to)
+ ];
+ }
+ }
+
$sources = $this->getModule('source')->getSources($params, $limit);
$this->output = $sources;
$this->error = SourceError::ERROR_NO_ERRORS;
"type": "integer"
}
},
+ {
+ "name": "endtime_from",
+ "in": "query",
+ "required": false,
+ "description": "End time from (UNIX timestamp format, seconds)",
+ "schema": {
+ "type": "integer"
+ }
+ },
+ {
+ "name": "endtime_to",
+ "in": "query",
+ "required": false,
+ "description": "End time to (UNIX timestamp format, seconds)",
+ "schema": {
+ "type": "integer"
+ }
+ },
{
"name": "jobstatus",
"in": "query",
"description": "Start time latest job using this source",
"type": "string"
},
+ "endtime": {
+ "description": "End time latest job using this source",
+ "type": "string"
+ },
"jobid": {
"description": "Latest jobid",
"type": "integer"