Commit 21d75827 authored by Taddeüs Kroes's avatar Taddeüs Kroes

Added number of matches to users overview

parent 1d768fd2
......@@ -9,13 +9,16 @@
<th>#</th>
<th>{_'Username'}</th>
<th>{_'Role'}</th>
<th>{_'Matches'}</th>
</tr>
</thead>
<tbody>
<tr n:foreach="$users as $user" data-href="user/{$user->id}">
{var $h = new UserHelper($user)}
<td>{$user->id}</td>
<td>{$user->username}</td>
<td>{_$user->role}</td>
<td>{$h->numberOfMatches()}</td>
</tr>
</tbody>
</table>
......
......@@ -112,10 +112,10 @@ class UserHelper {
$this->user = $dbuser;
}
public function numberOfMatches($discipline) {
return $this->user->related('match')
->where('discipline', $discipline)
->count();
public function numberOfMatches($discipline=null) {
$q = $this->user->related('match');
$discipline && $q->where('discipline', $discipline);
return $q->count();
}
public function averageMatchScore($discipline) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment