diff options
author | Joris | 2022-10-09 17:47:07 +0200 |
---|---|---|
committer | Joris | 2022-10-09 17:47:07 +0200 |
commit | fb38e8fd9ba849860e301a68cdd262b286c05711 (patch) | |
tree | 820811f412d8dd472a22d787a95bd9c6f6886253 /src/gui/mod.rs | |
parent | 76e841c740701c46969cf8cfeab94dc3cef65d9a (diff) | |
download | flashcards-fb38e8fd9ba849860e301a68cdd262b286c05711.tar.gz flashcards-fb38e8fd9ba849860e301a68cdd262b286c05711.tar.bz2 flashcards-fb38e8fd9ba849860e301a68cdd262b286c05711.zip |
Format code
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!( |