Skip to content

Commit

Permalink
Choose first socket when no default is specified (#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
kchapple committed Oct 25, 2020
1 parent c96d4fa commit 44c1f6c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/CareSet/Zermelo/Services/SocketService.php
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,14 @@ public function fetchSocketForWrenchKey( $key )
'is_default_socket' => 1
])->first();
}

// Finally, if there's no DEFAULT socket for this wrench, fetch the first one
if ( $foundSocket === null ) {
$foundSocket = Socket::where([
'wrench_id' => $wrench->id
])->orderBy('id', 'asc')->first();
}

} else {
throw new \Exception("Zermelo SocketWrench Error: No Wrench found for lookup string=`$key`");
}
Expand Down

0 comments on commit 44c1f6c

Please sign in to comment.