From 2a80cb78b501c7d95d7064dbeb42321e05bb1ea0 Mon Sep 17 00:00:00 2001 From: xeovalyte Date: Fri, 28 Jun 2024 14:51:09 +0200 Subject: [PATCH] Fixed divided by 0 error --- application/src/pages/groups.rs | 18 +++++++++++++++--- application/src/util/websocket/client.rs | 2 +- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/application/src/pages/groups.rs b/application/src/pages/groups.rs index 7d77089..11e6636 100644 --- a/application/src/pages/groups.rs +++ b/application/src/pages/groups.rs @@ -106,9 +106,21 @@ fn sort_by_total_score( .enumerate() .collect(); - let lifesaver_best = lifesaver_best.get(); - let popduiken_best = popduiken_best.get(); - let hindernis_best = hindernis_best.get(); + let mut lifesaver_best = lifesaver_best.get(); + let mut popduiken_best = popduiken_best.get(); + let mut hindernis_best = hindernis_best.get(); + + if lifesaver_best == 0 { + lifesaver_best = 10 * 60 * 1000; + } + + if popduiken_best == 0 { + popduiken_best = 10 * 60 * 1000; + } + + if hindernis_best == 0 { + hindernis_best = 10 * 60 * 1000; + } all_participants.sort_by(|(_, a), (_, b)| { let part_a = match a.value.get().events { diff --git a/application/src/util/websocket/client.rs b/application/src/util/websocket/client.rs index 1e72302..5ef2893 100644 --- a/application/src/util/websocket/client.rs +++ b/application/src/util/websocket/client.rs @@ -9,7 +9,7 @@ pub fn init_websocket() { ready_state, message, .. - } = use_websocket("ws://192.168.100.122:3000/ws"); + } = use_websocket("ws://192.168.0.150:3000/ws"); provide_context(ready_state);