1
0
Fork 0
mirror of synced 2024-10-01 17:58:02 +13:00

Merge pull request #7320 from appwrite/update-hamster-script

chore: update hamster script
This commit is contained in:
Christy Jacob 2023-12-22 15:08:04 +01:00 committed by GitHub
commit e1ebf153cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -53,8 +53,8 @@ class CalcTierStats extends Action
private array $usageStats = [
'network.requests' => 'Requests',
'network.inbound' => 'Inbound',
'network.outbound' => 'Outbound',
'network.inbound' => 'Inbound',
'network.outbound' => 'Outbound',
];
@ -208,11 +208,10 @@ class CalcTierStats extends Action
private function getData(Document $project, Database $dbForConsole, Database $dbForProject): array
{
$stats['Project ID'] = $project->getId();
$stats['Organization ID'] = $project->getAttribute('teamId', null);
$teamInternalId = $project->getAttribute('teamInternalId', 0);
$teamInternalId = $project->getAttribute('teamInternalId', null);
if ($teamInternalId) {
$membership = $dbForConsole->findOne('memberships', [
@ -233,10 +232,9 @@ class CalcTierStats extends Action
}
/** Get Total Members */
$teamInternalId = $project->getAttribute('teamInternalId', null);
if ($teamInternalId) {
$stats['Organization Members'] = $dbForConsole->count('memberships', [
Query::equal('$internalId', [(string)$teamInternalId])
Query::equal('teamInternalId', [$teamInternalId])
]);
} else {
$stats['Organization Members'] = 0;
@ -303,7 +301,7 @@ class CalcTierStats extends Action
/**
* Workaround to combine network.inbound+network.outbound as network.
*/
$stats['Network'] = ($stats['Inbound'] ?? 0) + ($stats['Outbound'] ?? 0);
$stats['Bandwidth'] = ($stats['Inbound'] ?? 0) + ($stats['Outbound'] ?? 0);
unset($stats['Inbound']);
unset($stats['Outbound']);