Implement method to get the oldest not yet started job

This commit is contained in:
Karsten Heiken
2011-08-25 21:34:04 +02:00
parent 75e69256b4
commit e055bc9914

View File

@@ -70,4 +70,12 @@ class Job extends CI_Model {
return $jobs;
}
/**
* Get a list of jobs that have not yet started running.
*/
public function getWaitingJob() {
$query = $this->db->order_by('created_at', 'asc')->get_where('jobs', array('started_at' => '0000-00-00 00:00:00'), 1);
return $this->db->count_all_results() > 0 ? $query->row() : FALSE;
}
}