| Conditions | 1 |
| Paths | 1 |
| Total Lines | 16 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 34 | public function getMostActiveWatchersQuery($instance) |
||
| 35 | { |
||
| 36 | $this->withColumn('user.name', 'userName'); |
||
| 37 | $this->withColumn('SUM((julianday(subscription.stopped) - julianday(subscription.started)) * 86400)', |
||
| 38 | 'totalTimeSeconds'); |
||
| 39 | |||
| 40 | $this->select(['userName', 'totalTimeSeconds']); |
||
| 41 | |||
| 42 | $this->useSubscriptionQuery()->filterByStopped(null, Criteria::NOT_EQUAL)->endUse(); |
||
| 43 | $this->filterByInstance($instance); |
||
| 44 | |||
| 45 | $this->groupBy('userName'); |
||
| 46 | $this->orderBy('totalTimeSeconds', Criteria::DESC); |
||
| 47 | |||
| 48 | return $this; |
||
| 49 | } |
||
| 50 | |||
| 52 |