-
Notifications
You must be signed in to change notification settings - Fork 0
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
Write a Wrapper for Anki Library to Get New Card Order #4
Comments
I've written some comments/suggestions below, feel free to ignore them. I highly recommend you think of the new card ordering as a function rather than a data structure. The As for a wrapper, you almost certainly don't need one. The functions provided by I've taken a look at your sorting code. There are of course many ways to do this, but I question whether you need a python
|
Just be clear, what I meant by "wrapper" is simply a function that maps each cid to a number used to sort the cards. I imagine it would be something like
Using a wrapper gives us the freedom to use different functions in tests that don't read from the database, plus we can write our code to interact with the interface that we design instead of being forced to conform to the
If it turns out that reading the sort order is slow, then I'll look into speeding it up, but it's better to start out designing the cleanest code and not worry about premature optimization.
I was on the fence about making it a class vs. a function, so I might switch. I'll have to give it more thought. |
I don't see the need for your sorting logic to interact with the database at all. No matter what type you use to represent cards, we will just call it |
@langfield, I've been looking into how to get the new card positions. Is this something you know how to do? |
I thought that maybe it would be |
Refer to this (slightly outdated) description of the database schema. I think you might just want There's also some good stuff in the manual. Reposition
Display Order
So it does look like the |
Thanks! That was helpful. I have a working proof-of-concept now in 99f5032 (see |
We need to get the new card order from the
anki
library to use for sorting. Rather than accessinganki
directly from the sorting code, we want a thin wrapper that provides the new car order. This can probably just be a single function that reads the database, although it might be more efficient to read in large batches.The text was updated successfully, but these errors were encountered: