Team-Abo-Uebersicht: nur aktive Berater zaehlen

Die Linientabelle zaehlte alle Downline-User statt nur aktive Berater
(m_level + gueltiges payment_account), wodurch zu viele Berater angezeigt
wurden. Filter-Logik aus BackofficeDashboardService (isActiveConsultant,
activeTeamUserIds) wiederverwendet und in TeamAboOverviewService
(buildLineRow, teamKpis, monthlyGrowth) angewendet.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Kevin 2026-06-25 13:25:44 +00:00
parent 386851aee8
commit 9565814221
3 changed files with 74 additions and 11 deletions

View file

@ -57,7 +57,7 @@ class TeamAboOverviewService
*/
public function teamKpis(User $user, int $month, int $year): array
{
$teamUserIds = $this->dashboardService->teamUserIds($user->id);
$teamUserIds = $this->dashboardService->activeTeamUserIds($user->id);
if ($teamUserIds === []) {
return [
@ -116,7 +116,7 @@ class TeamAboOverviewService
*/
public function monthlyGrowth(User $user, int $year): array
{
$teamUserIds = $this->dashboardService->teamUserIds($user->id);
$teamUserIds = $this->dashboardService->activeTeamUserIds($user->id);
$monthNames = \App\Services\HTMLHelper::getTransMonths();
$ownByMonth = $teamUserIds === [] ? [] : $this->newAbosByMonth($teamUserIds, 'user_id', 'me', $year);
@ -250,6 +250,11 @@ class TeamAboOverviewService
*/
private function buildLineRow(int $line, Collection $users, int $month, int $year): array
{
// Nur aktive Berater zählen/anzeigen (konsistent mit der Backoffice-Statistik).
// Die Baum-Traversierung in lineBuckets() bleibt unberührt, damit auch die
// Downline inaktiver Zwischen-Berater weiterhin erreicht wird.
$users = $users->filter(fn (User $teamUser) => $this->dashboardService->isActiveConsultant($teamUser))->values();
$userIds = $users->pluck('id')->map(fn ($id) => (int) $id)->all();
if ($userIds === []) {