getOne checks for uniqueness, but its perfectly valid to have more than

a single check, do'h!
This commit is contained in:
Thomas Keller 2011-12-24 02:56:11 +01:00
parent 6e305eb541
commit ff77046783

View File

@ -69,9 +69,9 @@ class IDF_ProjectActivity extends Pluf_Model
{ {
$prj = $this->get_project(); $prj = $this->get_project();
$sql = new Pluf_SQL('project=%s', array($prj->id)); $sql = new Pluf_SQL('project=%s', array($prj->id));
$latest = Pluf::factory('IDF_ProjectActivity')->getOne(array('filter' => $sql->gen(), 'order' => 'date desc')); $list = Pluf::factory('IDF_ProjectActivity')->getList(array('filter' => $sql->gen(), 'order' => 'date desc'));
if ($prj->current_activity != $latest->id) { if (count($list) > 0 && $prj->current_activity != $list[0]->id) {
$prj->current_activity = $latest; $prj->current_activity = $list[0];
$prj->update(); $prj->update();
} }
} }