summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-01-17 08:12:44 -0500
committerFrederic Guillot <fred@kanboard.net>2016-01-17 08:12:44 -0500
commit3c5762691827fae90d81ed05eee163da90140784 (patch)
tree7991eafabb0fb9bfe8739674d1f83dcee93eee6e /app
parent27b9b7a727de7a9608d85bce6ca94e81bbdf7ffb (diff)
Replace raw SQL query by PicoDb
Diffstat (limited to 'app')
-rw-r--r--app/Model/ProjectActivity.php10
-rw-r--r--app/Model/ProjectDailyColumnStats.php2
2 files changed, 3 insertions, 9 deletions
diff --git a/app/Model/ProjectActivity.php b/app/Model/ProjectActivity.php
index 309bab9a..d3aeefe5 100644
--- a/app/Model/ProjectActivity.php
+++ b/app/Model/ProjectActivity.php
@@ -169,14 +169,8 @@ class ProjectActivity extends Base
public function cleanup($max)
{
if ($this->db->table(self::TABLE)->count() > $max) {
- $this->db->execute('
- DELETE FROM '.self::TABLE.'
- WHERE id <= (
- SELECT id FROM (
- SELECT id FROM '.self::TABLE.' ORDER BY id DESC LIMIT 1 OFFSET '.$max.'
- ) foo
- )'
- );
+ $subquery = $this->db->table(self::TABLE)->desc('id')->limit($max)->columns('id');
+ $this->db->table(self::TABLE)->notInSubquery('id', $subquery)->remove();
}
}
diff --git a/app/Model/ProjectDailyColumnStats.php b/app/Model/ProjectDailyColumnStats.php
index c4a3f28e..83475246 100644
--- a/app/Model/ProjectDailyColumnStats.php
+++ b/app/Model/ProjectDailyColumnStats.php
@@ -159,7 +159,7 @@ class ProjectDailyColumnStats extends Base
* @param string $day
* @param string $column_id
* @param string $field
- * @return array
+ * @return integer
*/
private function findValueInMetrics(array &$metrics, $day, $column_id, $field)
{