added percentage
This commit is contained in:
parent
c529578069
commit
a4444a9fb1
|
@ -117,7 +117,7 @@ pub fn build_game(_w: &RefCell<ApplicationWindow>) -> Box {
|
|||
let answer: &String = &entry.text().to_string();
|
||||
println!("{} <-> {}? = {}", answer, correct_answer.borrow().to_string(), *answer == correct_answer.borrow().to_string());
|
||||
*stats.borrow_mut() = if *answer == correct_answer.borrow().to_string() { (stats.borrow().0 + 1, stats.borrow().1) } else {(stats.borrow().0, stats.borrow().1 + 1)};
|
||||
counter_label.borrow_mut().set_label(format!("Correct|Incorrect: {}|{}", stats.borrow().0, stats.borrow().1).as_str());
|
||||
counter_label.borrow_mut().set_label(format!("Correct|Incorrect: {}|{} ({:.2}%)", stats.borrow().0, stats.borrow().1, 100.0 * f64::from(stats.borrow().0) / f64::from(stats.borrow().0 + stats.borrow().1)).as_str());
|
||||
*question.borrow_mut() = ask(ktr, rtk, hiragana, katakana);
|
||||
*exact_kana.borrow_mut() =
|
||||
if hiragana && katakana {
|
||||
|
|
Loading…
Reference in New Issue