mirror of
https://github.com/appwrite/appwrite
synced 2026-05-24 09:28:40 +00:00
metrics adjustments
after and projectId additions
This commit is contained in:
parent
24d3aa499a
commit
ba44e06af6
1 changed files with 11 additions and 14 deletions
|
|
@ -211,21 +211,19 @@ class CalcTierStats extends Action
|
||||||
|
|
||||||
$teamInternalId = $project->getAttribute('teamInternalId', 0);
|
$teamInternalId = $project->getAttribute('teamInternalId', 0);
|
||||||
|
|
||||||
$team = $dbForConsole->findOne('teams', [
|
if ($teamInternalId) {
|
||||||
Query::equal('$internalId', [(string)$teamInternalId]),
|
$membership = $dbForConsole->findOne('memberships', [
|
||||||
|
Query::equal('teamInternalId', [$teamInternalId]),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$stats['Organization Email'] = '';
|
if (!$membership || $membership->isEmpty()) {
|
||||||
|
Console::error('Membership not found. Skipping project : ' . $project->getId());
|
||||||
|
}
|
||||||
|
|
||||||
if ($team !== false && !$team->isEmpty()) {
|
$userId = $membership->getAttribute('userId', null);
|
||||||
$userInternalId = $team->getAttribute('userInternalId', 0);
|
if ($userId) {
|
||||||
|
$user = $dbForConsole->getDocument('users', $userId);
|
||||||
$user = $dbForConsole->findOne('users', [
|
$stats['Organization Email'] = $user->getAttribute('email', null);
|
||||||
Query::equal('$internalId', [(string)$userInternalId]),
|
|
||||||
]);
|
|
||||||
|
|
||||||
if ($user !== false && !$user->isEmpty()) {
|
|
||||||
$stats['Organization Email'] = $user['email'];
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Console::error("Email was not found for this Organization ID :{$teamInternalId}");
|
Console::error("Email was not found for this Organization ID :{$teamInternalId}");
|
||||||
|
|
@ -271,8 +269,7 @@ class CalcTierStats extends Action
|
||||||
$limit = $periods[$range]['limit'];
|
$limit = $periods[$range]['limit'];
|
||||||
$period = $periods[$range]['period'];
|
$period = $periods[$range]['period'];
|
||||||
|
|
||||||
|
$requestDocs = $dbForProject->find('stats_v2', [
|
||||||
$requestDocs = $dbForProject->find('stats', [
|
|
||||||
Query::equal('metric', [$metric]),
|
Query::equal('metric', [$metric]),
|
||||||
Query::equal('period', [$period]),
|
Query::equal('period', [$period]),
|
||||||
Query::limit($limit),
|
Query::limit($limit),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue