Skip to content

Commit

Permalink
Small fix for counting devices for Summary collection page.
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-unwin committed Jun 26, 2017
1 parent b148524 commit f8e3616
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions code_igniter/application/models/m_summaries.php
Original file line number Diff line number Diff line change
Expand Up @@ -247,14 +247,16 @@ public function read_sub_resource($sub_resource = '')
$count = count($this->db->list_tables());
} else if ($collection == 'logs') {
$count = 2;
} else if ($collection == 'devices') {
$sql = "SELECT COUNT(*) AS `count` FROM `system`";
$count = $this->run_sql($sql);
$count = intval($count[0]->count);
} else if ($this->db->table_exists($collection)) {
$sql = "SELECT COUNT(*) AS `count` FROM `" . $collection . "`";
$count = $this->run_sql($sql);
$count = intval($count[0]->count);
} else {
if ($this->db->table_exists($collection)) {
$sql = "SELECT COUNT(*) AS `count` FROM `" . $collection . "`";
$count = $this->run_sql($sql);
$count = $count[0]->count;
} else {
$count = '';
}
$count = '';
}
$item = new stdClass();
$item->type = 'collection';
Expand Down

0 comments on commit f8e3616

Please sign in to comment.