Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement more Anki-like behavior #9

Open
asakura42 opened this issue Nov 18, 2021 · 2 comments
Open

Implement more Anki-like behavior #9

asakura42 opened this issue Nov 18, 2021 · 2 comments

Comments

@asakura42
Copy link

asakura42 commented Nov 18, 2021

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

@GrimPixel
Copy link

GrimPixel commented Apr 24, 2022

@asakura42 This is what you need
https://ankiweb.net/shared/info/90397199
https://ankiweb.net/shared/info/1736169259

@asakura42
Copy link
Author

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
 }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants