Skip to content

Commit 0beb0b3

Browse files
alexp8Sneer-ra2
andauthored
Develop to main (#397)
* Duplicate handling. * Added page of list with active duplicates. * Full IP-check for confirmed duplicates. * Simplification. * Removed comment. * Small update. * Added database migration. * Added unit test. * track observers * move comment * update image.php * fix null pointer (#379) * Develop (#380) (#381) * Duplicate handling. * Added page of list with active duplicates. * Full IP-check for confirmed duplicates. * Simplification. * Removed comment. * Small update. * Added database migration. * Added unit test. * track observers * move comment * update image.php * fix null pointer (#379) --------- Co-authored-by: Sneer <[email protected]> Co-authored-by: Sneer-ra2 <[email protected]> * add more logs (#382) * add more logs * update log * Fix for createPlayer. * fix bug where disconnect gave everyone minus points (#385) * fix bug where disconnect gave everyone minus points * fix ladder info map issue * Improved naming on elo page. * Improved description for duplicate reason. * bug fix * Database migration for user ratings. Player details and tooltip adjustments. * Updated admin rating page. * Quick fix. * Simplified conditions. * Fixed user settings update. * new implementation (#390) * verify observer is streaming on twitch (#384) * Show bans from duplicates. (#389) Co-authored-by: Alex Peterson <[email protected]> * bug fix (#392) * quick fix * Feature/track observers (#395) * bug fix * logging updates, 2v2 match bug fix, observer code * filter out spectator in point rewards * fix typo --------- Co-authored-by: Sneer <[email protected]> Co-authored-by: Sneer-ra2 <[email protected]>
1 parent 77f2435 commit 0beb0b3

File tree

1 file changed

+23
-3
lines changed

1 file changed

+23
-3
lines changed

cncnet-api/app/Http/Controllers/ApiLadderController.php

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ public function awardClanPoints($gameReport, $history)
351351
$clanGameReports = collect();
352352

353353
// Find the winning clan report
354-
$winningClanReport = $gameReport->playerGameReports()->where('won', 1)->groupBy("clan_id")->first();
354+
$winningClanReport = $gameReport->playerGameReports()->where('won', 1)->where('spectator', 0)->groupBy("clan_id")->first();
355355

356356
if ($winningClanReport != null)
357357
{
@@ -486,7 +486,7 @@ public function getWinningTeamFromReports($playerGameReports): ?string
486486
{
487487
foreach ($playerGameReports as $pgr)
488488
{
489-
if ($pgr->won)
489+
if ($pgr->won && $pgr->spectator == false)
490490
{
491491
return $pgr->team;
492492
}
@@ -495,7 +495,7 @@ public function getWinningTeamFromReports($playerGameReports): ?string
495495
// Step 2: Fallback — no winner marked; use a non-defeated player (disconnected game case)
496496
foreach ($playerGameReports as $pgr)
497497
{
498-
if (!$pgr->defeated && !$pgr->disconnected)
498+
if (!$pgr->defeated && !$pgr->disconnected && $pgr->spectator == false)
499499
{
500500
Log::info("Fallback to 'defeated' logic for disconnected game.", [
501501
'game_id' => $pgr->game_id,
@@ -549,6 +549,11 @@ public function awardTeamPoints(GameReport $gameReport, LadderHistory $history)
549549

550550
foreach ($playerGameReports as $playerGR)
551551
{
552+
if ($playerGR->spectator == true)
553+
{
554+
continue;
555+
}
556+
552557
$ally_average = 0;
553558
$ally_points = 0;
554559
$ally_count = 0;
@@ -565,6 +570,11 @@ public function awardTeamPoints(GameReport $gameReport, LadderHistory $history)
565570
// gather points from teammates and enemies, strength of team vs enemy will factor in points awarded/lost
566571
foreach ($playerGameReports as $otherPlayerGameReport)
567572
{
573+
if ($otherPlayerGameReport->spectator == true)
574+
{
575+
continue;
576+
}
577+
568578
$other = $this->playerService->findUserRatingByPlayerId($otherPlayerGameReport->player_id);
569579
$players[] = $other;
570580

@@ -706,6 +716,11 @@ public function awardPlayerPoints(GameReport $gameReport, LadderHistory $history
706716

707717
foreach ($playerGameReports as $playerGR)
708718
{
719+
if ($playerGR->spectator == true)
720+
{
721+
continue;
722+
}
723+
709724
$ally_average = 0;
710725
$ally_points = 0;
711726
$ally_count = 0;
@@ -716,6 +731,11 @@ public function awardPlayerPoints(GameReport $gameReport, LadderHistory $history
716731

717732
foreach ($playerGameReports as $pgr)
718733
{
734+
if ($pgr->spectator == true)
735+
{
736+
continue;
737+
}
738+
719739
$other = $this->playerService->findUserRatingByPlayerId($pgr->player_id);
720740
$players[] = $other;
721741

0 commit comments

Comments
 (0)