diff --git a/rslib/src/browser_table.rs b/rslib/src/browser_table.rs index 3c3a1c594..a8d1bf5c5 100644 --- a/rslib/src/browser_table.rs +++ b/rslib/src/browser_table.rs @@ -466,17 +466,18 @@ impl<'a> NoteRowContext<'a> { }) } + /// Returns the average ease of the non-new cards or a hint if there aren't any. fn note_ease_str(&self) -> String { - let cards = self + let eases: Vec = self .cards .iter() .filter(|c| c.ctype != CardType::New) - .collect::>(); - if cards.is_empty() { + .map(|c| c.ease_factor) + .collect(); + if eases.is_empty() { self.tr.browsing_new().into() } else { - let ease = cards.iter().map(|c| c.ease_factor).sum::() / cards.len() as u16; - format!("{}%", ease / 10) + format!("{}%", eases.iter().sum::() / eases.len() as u16 / 10) } }