From 0d1d1bf602ccea01f9fddf8068692eb5104d3f96 Mon Sep 17 00:00:00 2001 From: Adam Doyle Date: Tue, 3 Dec 2024 19:52:47 -0500 Subject: [PATCH] fix being able to submit 0 cards when judging and locking up the game --- client/src/components/game/views/judging.rs | 28 +++++++++++---------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/client/src/components/game/views/judging.rs b/client/src/components/game/views/judging.rs index 77411bf..de8a83d 100644 --- a/client/src/components/game/views/judging.rs +++ b/client/src/components/game/views/judging.rs @@ -67,21 +67,23 @@ pub fn JudgingView() -> impl IntoView { // Judging Submit Handler let submit_judge = move |_| { - let msg = to_string(&JudgeDecisionRequest { - game_id: game_meta().unwrap().uuid.clone(), - winning_cards: selected_cards() - .iter() - .map(|card| card.uuid.clone()) - .collect(), - }) - .unwrap(); + if !selected_cards().is_empty() { + let msg = to_string(&JudgeDecisionRequest { + game_id: game_meta().unwrap().uuid.clone(), + winning_cards: selected_cards() + .iter() + .map(|card| card.uuid.clone()) + .collect(), + }) + .unwrap(); - websocket.send(&msg); - set_selected_cards.update(|list| { - list.clear(); - }); + websocket.send(&msg); + set_selected_cards.update(|list| { + list.clear(); + }); - set_judge_round(None); + set_judge_round(None); + } }; view! {