Skip to content

Commit

Permalink
Fix Squawk Range Selection (#3)
Browse files Browse the repository at this point in the history
It wasn't properly shuffling the ranges.
  • Loading branch information
AndyTWF authored Jan 14, 2019
1 parent d246e47 commit 6c80afc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/Services/SquawkService.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ public function assignGeneralSquawk(string $callsign, string $origin, string $de

if ($ranges && $ranges->isNotEmpty()) {
foreach ($ranges as $generalSquawkRanges) {
foreach ($generalSquawkRanges->ranges as $possibleRange) {
$possibleRanges = $generalSquawkRanges->ranges->shuffle();
foreach ($possibleRanges as $possibleRange) {
// Check the applicable ranges for a squawk and see if we can find one.
$squawk = $this->searchForSquawkInRange($possibleRange);
if ($squawk !== false) {
Expand Down

0 comments on commit 6c80afc

Please sign in to comment.