diff options
Diffstat (limited to 'src/gui/mod.rs')
-rw-r--r-- | src/gui/mod.rs | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/gui/mod.rs b/src/gui/mod.rs index 92cd943..3599df8 100644 --- a/src/gui/mod.rs +++ b/src/gui/mod.rs @@ -51,13 +51,17 @@ pub fn start(conn: &Connection, term: &mut Term, events: &Events, deck_name: &st match db::pick_random_ready(conn) { Some(card) => { - let difficulty = question::ask(term, events, &title, &card)?; - answers += 1; - db::update( - conn, - &card.question, - &space_repetition::update(card.state, difficulty), - )?; + 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) { |