Skip to content
This repository has been archived by the owner on Sep 14, 2022. It is now read-only.

Commit

Permalink
fix stats
Browse files Browse the repository at this point in the history
  • Loading branch information
Davka committed Nov 13, 2020
1 parent 92a0780 commit 6bc3873
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 12 deletions.
37 changes: 28 additions & 9 deletions models/Metric.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')]
);
Expand Down Expand Up @@ -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,
Expand All @@ -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();
}
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"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": {
"prebuild": "npm install",
"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",
Expand Down
2 changes: 1 addition & 1 deletion plugin.manifest
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pluginname=SimpleBBB-Connector
pluginclassname=SimpleBBBConnector
origin=Vec
version=1.2.6
version=1.2.7
studipMinVersion=4.2

0 comments on commit 6bc3873

Please sign in to comment.