ImportSource: there is no end_time in ImportRun

This commit is contained in:
Thomas Gelf 2016-06-24 17:01:47 +02:00
parent 20197e1c9c
commit 39cf0a5fb8

View File

@ -29,7 +29,7 @@ class ImportSource extends DbObjectWithSettings
protected $settingsRemoteId = 'source_id'; protected $settingsRemoteId = 'source_id';
public function fetchLatestRun() public function fetchLastRun()
{ {
return $this->fetchLastRunBefore(time()); return $this->fetchLastRunBefore(time());
} }
@ -49,14 +49,14 @@ class ImportSource extends DbObjectWithSettings
array('ir' => 'import_run'), array('ir' => 'import_run'),
'ir.id' 'ir.id'
)->where('ir.source_id = ?', $this->id) )->where('ir.source_id = ?', $this->id)
->where('ir.end_time < ?', date('Y-m-d H:i:s', $timestamp)) ->where('ir.start_time < ?', date('Y-m-d H:i:s', $timestamp))
->order('ir.end_time DESC') ->order('ir.start_time DESC')
->limit(1); ->limit(1);
$runId = $db->fetchOne($query); $runId = $db->fetchOne($query);
if ($runId) { if ($runId) {
return ImportRun::fromDb($this->connection); return ImportRun::load($runId, $this->getConnection());
} else { } else {
return null; return null;
} }