proycon / vocage

A minimalistic spaced-repetion vocabulary trainer (flashcards) for the terminal

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Implement more Anki-like behavior

asakura42 opened this issue · comments

When I use anki, simply and in terms of your program — 1 button is to move card to first deck (1 min. for example) and 2 button is to promote card to the next deck. How to adjust your program to work like that? Totally newbie in Rust tho

solution:

diff --git a/src/lib.rs b/src/lib.rs
index ab9a3e9..c33d437 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -83,7 +83,7 @@ impl VocaSession {
         args.push( Arg::with_name("returntofirst")
             .long("returntofirst")
             .short("-1")
-            .help("When a card is demoted (e.g. answered incorrectly), demote it to the previous deck rather than the very first deck ")
+            .help("When a card is demoted (e.g. answered incorrectly), demote it to the very first deck rather than the previous deck")
         );
         args
     }
@@ -112,7 +112,7 @@ impl VocaSession {
             }
         }
         if args.is_present("returntofirst") {
-            self.returntofirst = false;
+            self.returntofirst = true;
         }

         //sanity checks and defaults
@@ -155,7 +155,7 @@ impl Default for VocaSession {
             columns: Vec::new(),
             decks: Vec::new(),
             intervals: Vec::new(),
-            returntofirst: true,
+            returntofirst: false,
             filename: None,
             showcolumns: Vec::new(),
             listdelimiter: None,
@@ -355,7 +355,7 @@ impl VocaData {
             file.write(listdelimiter.as_bytes())?;
             file.write(b"\n")?;
         }
-        if !self.session.returntofirst {
+        if self.session.returntofirst {
             file.write(b"#--returntofirst\n")?;
         }
         if !self.session.columns.is_empty() {
@@ -596,3 +596,5 @@ pub fn load_files(files: Vec<&str>, force: bool, reset: bool) -> Vec<VocaData> {

     datasets
 }