diff --git a/src/data.rs b/src/data.rs index 1ef8dea..a2dccd1 100644 --- a/src/data.rs +++ b/src/data.rs @@ -512,7 +512,7 @@ impl Filters { pub fn filter<'a>( &'a self, fish: Vec<&'a CombinedFish>, - caught_fish_ids: Vec, + caught_fish_ids: &Vec, ) -> Vec<&'a CombinedFish> { fish.into_iter() .filter(|fish| { diff --git a/src/main.rs b/src/main.rs index 8ed5ffa..fe8ae68 100644 --- a/src/main.rs +++ b/src/main.rs @@ -59,8 +59,8 @@ async fn new_account_handler(state: State>) -> Result, - pub big: Option<()>, + pub caught: Option, + pub big: Option, pub patches: Option>, } diff --git a/src/templates.rs b/src/templates.rs index 1e9bae2..cc42389 100644 --- a/src/templates.rs +++ b/src/templates.rs @@ -32,8 +32,7 @@ pub fn main_page( filters: &Filters, ) -> Markup { let meta = state.data.fish_with_meta(); - let mut values: Vec<&CombinedFish> = filters.filter(meta.values().collect(), caught_fish); - dbg!(&filters); + let mut values: Vec<&CombinedFish> = filters.filter(meta.values().collect(), &caught_fish); values.sort_by(|afish, bfish| { bfish @@ -104,8 +103,10 @@ pub fn main_page( section.up[fish.is_up].alwaysup[fish.is_always_up] { .title { div { - form action=(format!("/{}/catch/{}", acc_id, fish.entry.id)) method="post" { - button.catch-button type="submit" { (PreEscaped("✓")) } + @if !caught_fish.contains(&(fish.entry.id as i32)) { + form action=(format!("/{}/catch/{}", acc_id, fish.entry.id)) method="post" { + button.catch-button type="submit" { (PreEscaped("✓")) } + } } } div {