From ff7704678306a1bd3e4c5e9227aa61d97b40c2cf Mon Sep 17 00:00:00 2001 From: Thomas Keller Date: Sat, 24 Dec 2011 02:56:11 +0100 Subject: [PATCH] getOne checks for uniqueness, but its perfectly valid to have more than a single check, do'h! --- src/IDF/ProjectActivity.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/IDF/ProjectActivity.php b/src/IDF/ProjectActivity.php index 8b067de..0b0f65d 100644 --- a/src/IDF/ProjectActivity.php +++ b/src/IDF/ProjectActivity.php @@ -69,9 +69,9 @@ class IDF_ProjectActivity extends Pluf_Model { $prj = $this->get_project(); $sql = new Pluf_SQL('project=%s', array($prj->id)); - $latest = Pluf::factory('IDF_ProjectActivity')->getOne(array('filter' => $sql->gen(), 'order' => 'date desc')); - if ($prj->current_activity != $latest->id) { - $prj->current_activity = $latest; + $list = Pluf::factory('IDF_ProjectActivity')->getList(array('filter' => $sql->gen(), 'order' => 'date desc')); + if (count($list) > 0 && $prj->current_activity != $list[0]->id) { + $prj->current_activity = $list[0]; $prj->update(); } }