Incentive: Schalter "Abos beruecksichtigen", Recruiting Challenge ohne Abos

Die Recruiting Challenge erfasste Eigen- und Kundenabos mit 0 Punkten
(Live-Kopie: 175 Eigenabos). Sie tauchten in Details und Admin auf und
brachten Berater ohne Neupartner in die Rangliste.

- incentives.include_abos (Standard an); Migration schaltet Incentives
  ohne jede Abo-Wertung aus (0 Abo-Punkte, 0 Mindestabos, ohne Umsatzpunkte)
- aus: kein Abo-Tracking in Tracker, Neuaufbau und Reparatur;
  incentive:calculate raeumt vorhandene Abo-Zeilen ab
- Admin: Checkbox im Formular, Abo-Punkte/Mindestabos werden dann auf 0
  gesetzt; Abo-Spalte und -Bereiche in Admin, Details und Teilnahme-Hinweis
  entfallen
- Seeder der Recruiting Challenge setzt den Schalter aus

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Kevin 2026-09-24 11:37:32 +00:00
parent 773d523bf7
commit 11afdb11d1
19 changed files with 306 additions and 34 deletions

View file

@ -71,6 +71,7 @@ class Incentive extends Model
'bonus_rank_2' => 'float',
'bonus_rank_3' => 'float',
'include_sales_points' => 'bool',
'include_abos' => 'bool',
'status' => 'int',
'vip_only' => 'bool',
'qualification_start' => 'date',
@ -101,6 +102,7 @@ class Incentive extends Model
'bonus_rank_2',
'bonus_rank_3',
'include_sales_points',
'include_abos',
'status',
'vip_only',
];
@ -365,6 +367,15 @@ class Incentive extends Model
return $this->include_sales_points === null || (bool) $this->include_sales_points;
}
/**
* Werden Abos ueberhaupt erfasst? Aus = reine Recruiting-Challenge, weder Kunden-
* noch Eigenabos landen im Tracking.
*/
public function includesAbos(): bool
{
return $this->include_abos === null || (bool) $this->include_abos;
}
/**
* Gibt es eine Mindestqualifikation (direkte Partner oder Kundenabos)?
*/
@ -378,7 +389,7 @@ class Incentive extends Model
*/
public function usesAbos(): bool
{
return $this->points_abo_onetime > 0 || $this->min_customer_abos > 0;
return $this->includesAbos() && ($this->points_abo_onetime > 0 || $this->min_customer_abos > 0);
}
/**

View file

@ -325,7 +325,12 @@ class IncentiveParticipant extends Model
->where('created_at', '<', $qualStart)
->get();
foreach ($customerAbosInPeriod->concat($ownAbosInPeriod)->concat($ownAbosPreExisting) as $abo) {
// Incentive ohne Abos (reine Recruiting-Challenge): nichts erfassen
$abosToTrack = $incentive->includesAbos()
? $customerAbosInPeriod->concat($ownAbosInPeriod)->concat($ownAbosPreExisting)
: collect();
foreach ($abosToTrack as $abo) {
$activatedAt = $abo->created_at;
$logMonth = (int) $abo->created_at->month;
$logYear = (int) $abo->created_at->year;