From 6bc387369ba6cfcd7f3162da56a21fb81d71c48d Mon Sep 17 00:00:00 2001 From: David Siegfried Date: Fri, 13 Nov 2020 09:45:02 +0100 Subject: [PATCH] fix stats --- models/Metric.php | 37 ++++++++++++++++++++++++++++--------- package.json | 4 ++-- plugin.manifest | 2 +- 3 files changed, 31 insertions(+), 12 deletions(-) diff --git a/models/Metric.php b/models/Metric.php index 78ad5f3..669833a 100644 --- a/models/Metric.php +++ b/models/Metric.php @@ -35,7 +35,7 @@ public static function getCollectedYears() public static function getExport() { - list($start, $end) = array_map('date_create', [Request::get('from'), Request::get('to')]); + [$start, $end] = array_map('date_create', [Request::get('from'), Request::get('to')]); $metrics = self::findBySQL( 'start_time BETWEEN ? AND ? ORDER BY `mkdate`', [$start->format('Y-m-d H:i:s'), $end->format('Y-m-d H:i:s')] ); @@ -138,16 +138,23 @@ public static function collect() ->format(self::BBB_DATETIME_FORMAT); } + $meeting_id = (string)$meeting->meetingID; + $meeting_name = (string)$meeting->meetingName; + $participant_count = (string)$meeting->participantCount; + $video_count = (int)$meeting->videoCount; + $listener_count = (int)$meeting->listenerCount; + $voice_participant_count = (int)$meeting->voiceParticipantCount; + $moderator_count = (int)$meeting->moderatorCount; $data = [ 'server_id' => $server->id, - 'meeting_id' => (string)$meeting->meetingID, - 'meeting_name' => (string)$meeting->meetingName, - 'participant_count' => (string)$meeting->participantCount, - 'video_count' => (int)$meeting->videoCount, - 'listener_count' => (int)$meeting->listenerCount, - 'voice_participant_count' => (int)$meeting->voiceParticipantCount, - 'moderator_count' => (int)$meeting->moderatorCount, + 'meeting_id' => $meeting_id, + 'meeting_name' => $meeting_name, + 'participant_count' => $participant_count, + 'video_count' => $video_count, + 'listener_count' => $listener_count, + 'voice_participant_count' => $voice_participant_count, + 'moderator_count' => $moderator_count, 'is_break_out' => (string)$meeting->isBreakout === "true" ? 1 : 0, 'start_time' => $start_time, 'end_time' => $end_time, @@ -156,7 +163,19 @@ public static function collect() if (!$metric) { $metric = self::build($data); } else { - $metric->setData($data); + $values = [ + 'participant_count', + 'video_count', + 'listener_count', + 'voice_participant_count', + 'voice_participant_count', + 'moderator_count', + ]; + foreach($values as $value) { + if((int)$metric->$value <= $$value) { + $metric->$value = $$value; + } + } } $metric->store(); } diff --git a/package.json b/package.json index 5dee9d1..116d181 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "simplebbbconnector", - "version": "1.2.6", + "version": "1.2.7", "description": "To use the connector you need the api-informations for your BBB-Server.", "main": "index.js", "scripts": { @@ -8,7 +8,7 @@ "build": "webpack --mode production", "dev": "webpack --mode=development --watch", "prezip": "npm run build", - "zip": "zip -r SimpleBBBConnector-V$npm_package_version.zip assets classes controllers cronjobs migrations vendor models views README.md bootstrap.php SimpleBBBConnector.class.php plugin.manifest" + "zip": "zip -r SimpleBBBConnector-V$npm_package_version.zip assets classes controllers cronjobs migrations templates vendor models views README.md bootstrap.php SimpleBBBConnector.class.php plugin.manifest" }, "repository": { "type": "git", diff --git a/plugin.manifest b/plugin.manifest index 1f4424b..fa9904e 100644 --- a/plugin.manifest +++ b/plugin.manifest @@ -1,5 +1,5 @@ pluginname=SimpleBBB-Connector pluginclassname=SimpleBBBConnector origin=Vec -version=1.2.6 +version=1.2.7 studipMinVersion=4.2