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

[FEATURE REQUEST] Generate due date order #75

Open
darigovresearch opened this issue Mar 21, 2021 · 6 comments
Open

[FEATURE REQUEST] Generate due date order #75

darigovresearch opened this issue Mar 21, 2021 · 6 comments

Comments

@darigovresearch
Copy link

Currently when generating decks with genanki all the cards have the due date/order of 0. This can be seen when viewing the deck in the browser.

Would be great to auto-generate the due order within the code if possible or to be able to set the start so that it would start counting from the value given instead of zero.

This is particularly helpful when auto generating flashcards for a course where learning order makes it easier to learn.

Again, would be happy to do a pull request if given guidance on where to insert what in the relevant sections of the codebase.

@z1lc
Copy link
Contributor

z1lc commented May 15, 2021

I just tested this locally and it should be fairly straightforward -- we just need to be able to pass due as an argument to Card::write_to_db:

genanki/genanki/card.py

Lines 6 to 27 in fc8148a

def write_to_db(self, cursor, timestamp: float, deck_id, note_id, id_gen):
queue = -1 if self.suspend else 0
cursor.execute('INSERT INTO cards VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?);', (
next(id_gen), # id
note_id, # nid
deck_id, # did
self.ord, # ord
int(timestamp), # mod
-1, # usn
0, # type (=0 for non-Cloze)
queue, # queue
0, # due
0, # ivl
0, # factor
0, # reps
0, # lapses
0, # left
0, # odue
0, # odid
0, # flags
"", # data
))

@z1lc
Copy link
Contributor

z1lc commented May 15, 2021

Quick PR to prove out the idea: #80

@darigovresearch
Copy link
Author

@z1lc thanks for taking a look and for making a pull request, there appears to be an error in the pull request. Could you take a look and see if you can resolve it?

It may help to make it easier to merge your pull request

@kerrickstaley
Copy link
Owner

The Travis checks were erroring out and I've switched this repo to use GitHub Actions anyway. I disabled Travis on master and merged master into @z1lc's branch, and it looks like tests are passing now. I'll review the PR.

@z1lc
Copy link
Contributor

z1lc commented Aug 1, 2021

@kerrickstaley I think we can close this issue thanks to our PR? Forgot to mention it in the description so this wasn't auto-resolved.

@timo-berg
Copy link

timo-berg commented Nov 8, 2022

How does the due field work? I attempted to set it to the number of days until the card is due using an integer, but when I import the deck into Anki, all cards are marked as "New". Is this a bug or do I have to mark the cards specifically as being "not-new"?

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

4 participants