summaryrefslogtreecommitdiff
path: root/src/Controllers
diff options
context:
space:
mode:
Diffstat (limited to 'src/Controllers')
-rw-r--r--src/Controllers/Metrics/Controller.php1
-rw-r--r--src/Controllers/Metrics/Stats.php9
2 files changed, 10 insertions, 0 deletions
diff --git a/src/Controllers/Metrics/Controller.php b/src/Controllers/Metrics/Controller.php
index 99b71335..a47b8159 100644
--- a/src/Controllers/Metrics/Controller.php
+++ b/src/Controllers/Metrics/Controller.php
@@ -93,6 +93,7 @@ class Controller extends BaseController
['labels' => ['state' => 'arrived', 'working' => 'no'], 'value' => $this->stats->arrivedUsers(false)],
['labels' => ['state' => 'arrived', 'working' => 'yes'], 'value' => $this->stats->arrivedUsers(true)],
],
+ 'users_force_active' => ['type' => 'gauge', $this->stats->forceActiveUsers()],
'licenses' => [
'type' => 'gauge',
'help' => 'The total number of licenses',
diff --git a/src/Controllers/Metrics/Stats.php b/src/Controllers/Metrics/Stats.php
index b7aecffd..91ee4853 100644
--- a/src/Controllers/Metrics/Stats.php
+++ b/src/Controllers/Metrics/Stats.php
@@ -7,6 +7,7 @@ use Engelsystem\Database\Database;
use Engelsystem\Models\EventConfig;
use Engelsystem\Models\News;
use Engelsystem\Models\Question;
+use Engelsystem\Models\User\State;
use Illuminate\Database\Query\Builder as QueryBuilder;
use Illuminate\Database\Query\Expression as QueryExpression;
@@ -80,6 +81,14 @@ class Stats
}
/**
+ * @return int
+ */
+ public function forceActiveUsers(): int
+ {
+ return State::whereForceActive(true)->count();
+ }
+
+ /**
* The number of currently working users
*
* @param null $freeloaded