diff options
Diffstat (limited to 'src/gui/mod.rs')
-rw-r--r-- | src/gui/mod.rs | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/gui/mod.rs b/src/gui/mod.rs index 3599df8..b39cbcf 100644 --- a/src/gui/mod.rs +++ b/src/gui/mod.rs @@ -50,19 +50,17 @@ pub fn start(conn: &Connection, term: &mut Term, events: &Events, deck_name: &st let title = title(deck_name, answers, db::count_available(conn).unwrap_or(0)); match db::pick_random_ready(conn) { - Some(card) => { - match question::ask(term, events, &title, &card)? { - question::Response::Aborted => break, - question::Response::Answered { difficulty } => { - answers += 1; - db::update( - conn, - &card.question, - &space_repetition::update(card.state, difficulty), - )?; - } + Some(card) => match question::ask(term, events, &title, &card)? { + question::Response::Aborted => break, + question::Response::Answered { difficulty } => { + answers += 1; + db::update( + conn, + &card.question, + &space_repetition::update(card.state, difficulty), + )?; } - } + }, None => { let message = match db::next_ready(conn) { Some(ready) => format!( |