Skip to content

Commit 2beb142

Browse files
alexp8Sneer-ra2Copilot
authored
Develop to main (#409)
* UI part and DB migration. * fix .clan view not found, enable new 2v2 matching logic * Added faction policy service. * Added point system simulation. * Route for point system simulation. * Changes according to code review. * Added default values. * Fixed counting factions played per month. * Minor improvements. * feature/show observers page (#405) * add a page to view observers * Update cncnet-api/app/Http/Controllers/AdminController.php Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]> * include user alias in observers page * 2v2 match fix * fix duplicate team member * sort players by pts and time in queue --------- Co-authored-by: Sneer <[email protected]> Co-authored-by: Sneer-ra2 <[email protected]> Co-authored-by: Copilot <[email protected]>
1 parent 8195de3 commit 2beb142

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

cncnet-api/app/Extensions/Qm/Matchup/TeamMatchupHandler.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,12 @@ public function getEntriesInPointRange2v2(QmQueueEntry $currentQmQueueEntry, Col
169169
return collect();
170170
}
171171

172-
// Sort opponents by closeness in points to the current player
173-
$sortedOpponents = $potentialOpponents->sortBy(function ($opponent) use ($currentQmQueueEntry)
174-
{
175-
return abs($currentQmQueueEntry->points - $opponent->points);
172+
// Sort opponents by a combination of point difference and time in queue bonus
173+
$pointsPerSecond = $rules->points_per_second;
174+
$sortedOpponents = $potentialOpponents->sortBy(function ($opponent) use ($currentQmQueueEntry, $pointsPerSecond) {
175+
$pointDiff = abs($currentQmQueueEntry->points - $opponent->points);
176+
$waitTimeBonus = (strtotime($opponent->updated_at) - strtotime($opponent->created_at)) * $pointsPerSecond;
177+
return $pointDiff - $waitTimeBonus;
176178
})->values();
177179

178180
// Try all possible 3-player combinations (since the current player makes 4)

0 commit comments

Comments
 (0)