diff --git a/application/src/app.rs b/application/src/app.rs index 63831ad..71677c9 100644 --- a/application/src/app.rs +++ b/application/src/app.rs @@ -1,3 +1,4 @@ +#![feature(diagnostic_namespace)] use crate::error_template::{AppError, ErrorTemplate}; use leptos::*; use leptos_meta::*; diff --git a/application/src/main.rs b/application/src/main.rs index abad6ce..07254b9 100644 --- a/application/src/main.rs +++ b/application/src/main.rs @@ -1,3 +1,4 @@ +#![feature(diagnostic_namespace)] #[cfg(feature = "ssr")] #[tokio::main] async fn main() { diff --git a/application/src/pages/groups.rs b/application/src/pages/groups.rs index 58d33b3..767ac3e 100644 --- a/application/src/pages/groups.rs +++ b/application/src/pages/groups.rs @@ -1,5 +1,6 @@ -use crate::components; +use crate::components::{self, participant}; use crate::util::surrealdb::schemas; +use futures::stream::ForEach; use leptos::*; /// Renders the home page of your application. @@ -23,6 +24,37 @@ pub fn Groups() -> impl IntoView { let (participants_lifesaver, participants_hindernis, participants_popduiken) = sort_by_events(participants_filtered); + let lifesaver_best = create_memo(move |_| match participants_lifesaver.get().get(0) { + Some(p) => match p.value.get().events { + Some(e) => e.lifesaver.unwrap_or(0), + None => 6_000_000, + }, + None => 6_000_000, + }); + + let hindernis_best = create_memo(move |_| match participants_hindernis.get().get(0) { + Some(p) => match p.value.get().events { + Some(e) => e.hindernis.unwrap_or(0), + None => 6_000_000, + }, + None => 6_000_000, + }); + + let popduiken_best = create_memo(move |_| match participants_popduiken.get().get(0) { + Some(p) => match p.value.get().events { + Some(e) => e.popduiken.unwrap_or(0), + None => 6_000_000, + }, + None => 6_000_000, + }); + + let total_score_participants = sort_by_total_score( + participants_filtered, + lifesaver_best, + hindernis_best, + popduiken_best, + ); + view! {