mirror of
https://github.com/ad-aures/castopod.git
synced 2026-04-16 04:57:46 +02:00
feat(analytics): add 'other' group to pie charts in order to display more accurate data
This commit is contained in:
parent
ba89fd590d
commit
73acef933f
7 changed files with 44 additions and 75 deletions
|
|
@ -33,16 +33,16 @@ class AnalyticsWebsiteByBrowserModel extends Model
|
|||
public function getData(int $podcastId): array
|
||||
{
|
||||
if (!($found = cache("{$podcastId}_analytics_website_by_browser"))) {
|
||||
$oneWeekAgo = date('Y-m-d', strtotime('-1 week'));
|
||||
$found = $this->select('`browser` as `labels`')
|
||||
->selectSum('`hits`', '`values`')
|
||||
->where([
|
||||
'`podcast_id`' => $podcastId,
|
||||
'`date` >' => date('Y-m-d', strtotime('-1 week')),
|
||||
'`date` >' => $oneWeekAgo,
|
||||
])
|
||||
->groupBy('`labels`')
|
||||
->orderBy('`values`', 'DESC')
|
||||
->findAll(10);
|
||||
|
||||
->findAll();
|
||||
cache()->save(
|
||||
"{$podcastId}_analytics_website_by_browser",
|
||||
$found,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue