removing unrecognized tests

This commit is contained in:
2026-03-08 12:38:38 +01:00
parent ac66404055
commit 840e8ee6e0

View File

@@ -2,7 +2,7 @@ use crate::components::{select::*, skeleton::*};
use crate::loader::Loader; use crate::loader::Loader;
use csv::{ReaderBuilder, StringRecord}; use csv::{ReaderBuilder, StringRecord};
use dioxus::prelude::*; use dioxus::prelude::*;
use dioxus_primitives::toast::{use_toast, ToastOptions}; use dioxus_primitives::toast::{ToastOptions, use_toast};
use dioxus_sdk_time::*; use dioxus_sdk_time::*;
use std::collections::HashMap; use std::collections::HashMap;
use std::f32::consts::PI; use std::f32::consts::PI;
@@ -326,10 +326,11 @@ pub fn Landing() -> Element {
} }
} }
let Ok(status) = TestStatus::from_str(&r[1]) else {
continue;
};
if let Some(wanted) = f { if let Some(wanted) = f {
let Ok(status) = TestStatus::from_str(&r[1]) else {
continue;
};
if status != wanted { if status != wanted {
continue; continue;
} }
@@ -466,23 +467,22 @@ pub fn Landing() -> Element {
} }
} }
for test in page.iter() { for test in page.iter() {
tr { class: "text-sm hover:bg-[#38bef7]/5", if let Ok(status) = TestStatus::from_str(&test[1]) {
td { class: "py-2 px-3", "{&test[0]}" } tr { class: "text-sm hover:bg-[#38bef7]/5",
td { class: "py-2 px-3", td { class: "py-2 px-3", "{&test[0]}" }
p { class: "mx-auto w-fit", td { class: "py-2 px-3",
if let Ok(duration) = test[2].parse::<f32>() { p { class: "mx-auto w-fit",
"{HMSDuration(Duration::from_secs_f32(duration))}" if let Ok(duration) = test[2].parse::<f32>() {
} else { "{HMSDuration(Duration::from_secs_f32(duration))}"
"Invalid data" } else {
"Invalid data"
}
} }
} }
} td { class: "py-2 px-3",
td { class: "py-2 px-3", StatusBadge {
StatusBadge { status
status: match TestStatus::from_str(&test[1]) { }
Ok(s) => Some(s),
_ => None,
},
} }
} }
} }
@@ -532,27 +532,21 @@ fn StatCard(name: String, color: String, count: usize, stat: f32) -> Element {
} }
#[component] #[component]
fn StatusBadge(status: Option<TestStatus>) -> Element { fn StatusBadge(status: TestStatus) -> Element {
let color = match status {
Some(s) => s.color(),
None => "#FFF",
};
let name = match status {
Some(s) => s.to_string(),
None => "Unrecognized".to_string(),
};
rsx! { rsx! {
div { div {
class: "mx-auto border-1 py-1 px-3 rounded-3xl text-xs w-fit select-none", class: "mx-auto border-1 py-1 px-3 rounded-3xl text-xs w-fit select-none",
style: format!( style: format!(
r#" r#"
background-color: {color}0F; background-color: {}0F;
color: {color}; color: {};
border-color: {color}; border-color: {};
"#, "#,
status.color(),
status.color(),
status.color(),
), ),
"{name}" "{status.to_string()}"
} }
} }
} }