Skip to content

Commit

Permalink
Hide keys with 100% accuracy in the result view
Browse files Browse the repository at this point in the history
  • Loading branch information
okin authored and max-niederman committed Nov 28, 2023
1 parent 6da5838 commit e4096f4
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,18 +334,19 @@ impl ThemedWidget for &results::Results {
worst_text.extend(
worst_keys
.iter()
.take(5)
.filter_map(|(key, acc)| {
if let KeyCode::Char(character) = key.code {
Some(format!(
"- {} at {:.1}% accuracy",
character,
f64::from(**acc) * 100.0,
))
let key_accuracy = f64::from(**acc) * 100.0;
if key_accuracy != 100.0 {
Some(format!("- {} at {:.1}% accuracy", character, key_accuracy))
} else {
None
}
} else {
None
}
})
.take(5)
.map(Line::from),
);
let worst = Paragraph::new(worst_text).block(
Expand Down

0 comments on commit e4096f4

Please sign in to comment.