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
78
78
{
79
79
while (true ) {
80
80
foreach ($ this ->ledPins as $ id => $ pin ) {
81
- echo 'Turning on ' . $ id. "\n" ;
81
+ echo 'Turning on ' . $ id . "\n" ;
82
82
$ pin ->turnOff ();
83
83
sleep (1 );
84
84
$ pin ->turnOn ();
@@ -94,11 +94,11 @@ private function checkButtons(): void
94
94
$ this ->info ("Button on pin # {$ index } is pressed " );
95
95
96
96
try {
97
- Http::get ('http://sierra.local:8000/api/buzzer ' , [
97
+ Http::timeout ( 1 )-> get ('http://sierra.local:8000/api/buzzer ' , [
98
98
'pin_id ' => $ index ,
99
99
]);
100
100
} 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 ());
102
102
}
103
103
104
104
for ($ i = 0 ; $ i < 5 ; $ i ++) {
Original file line number Diff line number Diff line change 8
8
use Exception ;
9
9
use Illuminate \Http \JsonResponse ;
10
10
use Illuminate \Http \Request ;
11
+ use RuntimeException ;
11
12
12
13
class BuzzerController extends Controller
13
14
{
@@ -37,6 +38,10 @@ public function __invoke(Request $request): JsonResponse
37
38
};
38
39
39
40
try {
41
+ if ($ team ->game ->current_team_id ) {
42
+ throw new RuntimeException ('Another team already has the buzzer ' );
43
+ }
44
+
40
45
// Use centralized buzzer handling logic
41
46
$ this ->buzzerService ->handleBuzzerPress ($ team );
42
47
Original file line number Diff line number Diff line change @@ -24,6 +24,16 @@ class LightningRound extends Component
24
24
public function mount ($ gameId )
25
25
{
26
26
$ 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
+
27
37
$ this ->loadCurrentQuestion ();
28
38
}
29
39
You can’t perform that action at this time.
0 commit comments