-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Some documentation and reduce copy/paste #3917
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
Conversation
5f0af05 to
e13c082
Compare
|
Wasn't this issue already solved by #3890? |
|
It seems so. I looked for this march 16 when I opened the bug in ankidroid. I had no idea that somebody solved it in the meantime. Wonderful. |
I needed to know because {{c1 generate card 0 for example. And storing
the card ordinal would have been another consistent choice.
e13c082 to
adc3f72
Compare
|
Also, we'll need to check. But given that we have always a small cost to pay to send request to the back-end, a method that returns all data may be better than having to send one request by template, especially as long as it does not provide a way to send multiple request as a batch. But i'll see whether it makes sense when we can actually test the feature |
This slightly reduce code duplication.
adc3f72 to
8e6351c
Compare
If it proves necessary in the future, we can always add it then. |
This PR initially offered to solve an already solved issue that I missed.
The first two commits were some clean-up that I believe are still improving the codebase, so I keep this PR open but removed the last commit.
Here is the original description:
Introduce get_non_empty_card_indexes
This method takes a note type id and the content of fields. It returns
the order of the cards that would be non-empty according to this note.
To be more specific, for cloze type, it return any cloze
number (except 0), even if it does not appear in a cloze field, in
order to be consistent with the way anki generates note.
For normal type, for each template, it returns whether the card would
be generated, and also whether the template has an error.
The goal here is to allow ankidroid to display in the note editor's
previewer which card will be generated. Which is done currently by
checking whether the "empty card" message appear in the previewer,
which is not ideal.
Please let me know whether you'd accept this service. In which case I'll add a few tests with the default note type. I preferred not to spend more time adding tests until I know whether it'd be useful or not