File tree Expand file tree Collapse file tree 3 files changed +18
-3
lines changed Expand file tree Collapse file tree 3 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -78,7 +78,7 @@ private function loopLEDs(): void
7878 {
7979 while (true ) {
8080 foreach ($ this ->ledPins as $ id => $ pin ) {
81- echo 'Turning on ' . $ id. "\n" ;
81+ echo 'Turning on ' . $ id . "\n" ;
8282 $ pin ->turnOff ();
8383 sleep (1 );
8484 $ pin ->turnOn ();
@@ -94,11 +94,11 @@ private function checkButtons(): void
9494 $ this ->info ("Button on pin # {$ index } is pressed " );
9595
9696 try {
97- Http::get ('http://sierra.local:8000/api/buzzer ' , [
97+ Http::timeout ( 1 )-> get ('http://sierra.local:8000/api/buzzer ' , [
9898 'pin_id ' => $ index ,
9999 ]);
100100 } catch (Exception $ e ) {
101- $ this ->error ("Failed to send request for pin # {$ index }: " . $ e ->getMessage ());
101+ $ this ->error ("Failed to send request for pin # {$ index }: " . $ e ->getMessage ());
102102 }
103103
104104 for ($ i = 0 ; $ i < 5 ; $ i ++) {
Original file line number Diff line number Diff line change 88use Exception ;
99use Illuminate \Http \JsonResponse ;
1010use Illuminate \Http \Request ;
11+ use RuntimeException ;
1112
1213class BuzzerController extends Controller
1314{
@@ -37,6 +38,10 @@ public function __invoke(Request $request): JsonResponse
3738 };
3839
3940 try {
41+ if ($ team ->game ->current_team_id ) {
42+ throw new RuntimeException ('Another team already has the buzzer ' );
43+ }
44+
4045 // Use centralized buzzer handling logic
4146 $ this ->buzzerService ->handleBuzzerPress ($ team );
4247
Original file line number Diff line number Diff line change @@ -24,6 +24,16 @@ class LightningRound extends Component
2424 public function mount ($ gameId )
2525 {
2626 $ this ->game = Game::with ('lightningQuestions ' , 'teams ' )->findOrFail ($ gameId );
27+
28+ // Clear any lingering team selection from the main game
29+ if ($ this ->game ->current_team_id ) {
30+ $ this ->game ->update (['current_team_id ' => null ]);
31+ $ this ->game ->refresh ();
32+
33+ // Broadcast to clear team selection on all clients
34+ broadcast (new \App \Events \GameStateChanged ($ this ->game ->id , 'team-deselected ' ));
35+ }
36+
2737 $ this ->loadCurrentQuestion ();
2838 }
2939
You can’t perform that action at this time.
0 commit comments