stats: added pronoun
This commit is contained in:
parent
1cfab91f28
commit
cb2ec5457e
|
@ -106,6 +106,7 @@ class Controller extends BaseController
|
||||||
['labels' => ['state' => 'arrived', 'working' => 'yes'], 'value' => $this->stats->arrivedUsers(true)],
|
['labels' => ['state' => 'arrived', 'working' => 'yes'], 'value' => $this->stats->arrivedUsers(true)],
|
||||||
],
|
],
|
||||||
'users_force_active' => ['type' => 'gauge', $this->stats->forceActiveUsers()],
|
'users_force_active' => ['type' => 'gauge', $this->stats->forceActiveUsers()],
|
||||||
|
'users_pronouns' => ['type' => 'gauge', $this->stats->usersPronouns()],
|
||||||
'licenses' => [
|
'licenses' => [
|
||||||
'type' => 'gauge',
|
'type' => 'gauge',
|
||||||
'help' => 'The total number of licenses',
|
'help' => 'The total number of licenses',
|
||||||
|
|
|
@ -93,6 +93,14 @@ class Stats
|
||||||
return State::whereForceActive(true)->count();
|
return State::whereForceActive(true)->count();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
public function usersPronouns(): int
|
||||||
|
{
|
||||||
|
return PersonalData::where('pronoun', '!=', '')->count();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $type
|
* @param string $type
|
||||||
*
|
*
|
||||||
|
|
|
@ -238,6 +238,17 @@ class StatsTest extends TestCase
|
||||||
$this->assertEquals(2, $stats->forceActiveUsers());
|
$this->assertEquals(2, $stats->forceActiveUsers());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers \Engelsystem\Controllers\Metrics\Stats::usersPronouns
|
||||||
|
*/
|
||||||
|
public function testUsersPronouns()
|
||||||
|
{
|
||||||
|
$this->addUsers();
|
||||||
|
|
||||||
|
$stats = new Stats($this->database);
|
||||||
|
$this->assertEquals(2, $stats->usersPronouns());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @covers \Engelsystem\Controllers\Metrics\Stats::email
|
* @covers \Engelsystem\Controllers\Metrics\Stats::email
|
||||||
*/
|
*/
|
||||||
|
@ -380,10 +391,14 @@ class StatsTest extends TestCase
|
||||||
$this->addUser();
|
$this->addUser();
|
||||||
$this->addUser([], ['shirt_size' => 'L'], ['email_human' => true, 'email_shiftinfo' => true]);
|
$this->addUser([], ['shirt_size' => 'L'], ['email_human' => true, 'email_shiftinfo' => true]);
|
||||||
$this->addUser(['arrived' => 1], [], ['email_human' => true, 'email_news' => true]);
|
$this->addUser(['arrived' => 1], [], ['email_human' => true, 'email_news' => true]);
|
||||||
$this->addUser(['arrived' => 1], [], ['language' => 'lo_RM', 'email_shiftinfo' => true]);
|
$this->addUser(['arrived' => 1], ['pronoun' => 'unicorn'], ['language' => 'lo_RM', 'email_shiftinfo' => true]);
|
||||||
$this->addUser(['arrived' => 1, 'got_voucher' => 2], ['shirt_size' => 'XXL'], ['language' => 'lo_RM']);
|
$this->addUser(['arrived' => 1, 'got_voucher' => 2], ['shirt_size' => 'XXL'], ['language' => 'lo_RM']);
|
||||||
$this->addUser(['arrived' => 1, 'got_voucher' => 9, 'force_active' => true], [], ['theme' => 1]);
|
$this->addUser(['arrived' => 1, 'got_voucher' => 9, 'force_active' => true], [], ['theme' => 1]);
|
||||||
$this->addUser(['arrived' => 1, 'got_voucher' => 3], [], ['theme' => 1, 'email_human' => true]);
|
$this->addUser(
|
||||||
|
['arrived' => 1, 'got_voucher' => 3],
|
||||||
|
['pronoun' => 'per'],
|
||||||
|
['theme' => 1, 'email_human' => true]
|
||||||
|
);
|
||||||
$this->addUser(['arrived' => 1, 'active' => 1, 'got_shirt' => true, 'force_active' => true]);
|
$this->addUser(['arrived' => 1, 'active' => 1, 'got_shirt' => true, 'force_active' => true]);
|
||||||
$this->addUser(['arrived' => 1, 'active' => 1, 'got_shirt' => true], ['shirt_size' => 'L'], ['theme' => 4]);
|
$this->addUser(['arrived' => 1, 'active' => 1, 'got_shirt' => true], ['shirt_size' => 'L'], ['theme' => 4]);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue