kerrickstaley / genanki

A Python 3 library for generating Anki decks
MIT License
2.06k stars 161 forks source link

[FEATURE REQUEST] Generate due date order #75

Open darigovresearch opened 3 years ago

darigovresearch commented 3 years ago

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 commented 3 years ago

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: https://github.com/kerrickstaley/genanki/blob/fc8148ab5cabeb16e8957ebb3e7d8ec48bed7cf5/genanki/card.py#L6-L27

z1lc commented 3 years ago

Quick PR to prove out the idea: https://github.com/kerrickstaley/genanki/pull/80

darigovresearch commented 3 years ago

@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 commented 3 years ago

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 commented 3 years ago

@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 commented 2 years ago

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"?

Pieter-JanLavaerts commented 4 months ago

I also don't get how the due field works. I thought it would be a sort order so I gave my notes indices according to how I want to review my notes but it doesn't work.

darigovresearch commented 4 months ago

@z1lc any thoughts on @timo-berg or @Pieter-JanLavaerts 's queries?

Hope to test this feature soon but you my be able to resolve their queries in the meantime

Thanks for putting in a pull request and glad to see it got merged

z1lc commented 4 months ago

In my own testing it does indeed work as a sort order -- however this is only the case if the cards are new and not updates. That is, once a card uses a specific due date, it will not be updated by a later import by a generation through genanki, at least in my experience.