1. How to store and retrieve the number of cards I didn’t review then display it in the Deck Browser?
I’ve been customizing Anki’s Deck Browser and Reviewer in the last few days to make it display some stats about my Collection of cards and my study routine.
One of the things I have in mind but have no idea about how to “materialize” is to display the number of cards I didn’t review for each one of the last 7 days, as well as to be able to access the respective data from previous weeks.
I already know that I can get access to new remaining, learn remaining and review remaining data for the current day trough the todayStats()
function as well as trough mw.col._backend.congrats_info().new_remaining
, mw.col._backend.congrats_info().learn_remaining
and mw.col._backend.congrats_info().review_remaining
respectively (if you know a better way to do it, please share it with me).
However, I didn’t find a way to retrieve the correspondent data from the previous days.
So, my idea is
-
To store the data from the current day somewhere (I’ve seen that the add-on Countdown to events and exams use a .db file to store data, but I’ve also read that it’s possible to use JSON to do the same thing - if I understood it correctly),
-
Then make Anki access and display it in the Deck Browser (if I studied all the cards, display a
, if I studied zero cards, display a
, if I left some (but not all) cards due, display the number of cards left).
-
Click in a button somewhere in the Deck Browser (or maybe the Stats link in the toolbar) to open a window that displays the data from the previous weeks (Date - Day of the week - Number of cards left).
My questions are:
- How to make Anki store the number of cards that I didn’t study every day, alongside with the respective date and day of the week?
- How to retrieve the data from the previous 7 days?
- How to display it in the Deck Browser?
3.1. To be more precise: What is the correct procedure to append the code to the Deck Browser, as I’ve got errors while trying to append the settings button from the Countdown to Events and Exams add-on to the Reviewer? - Are there a better way to do it than this one I’m suggesting?
> 2. How to use the variable thetime
in stats.py's
function todayStats
to make a pomodoro like timer?
I’ve read some tutorials about how to create a pomodoro timer using Python, but all of them relies on the function time.sleep()
to work, which doesn’t suit my needs, as I want a timer that uses the time I really spent reviewing cards as reference.
The only way I know (that I hope is viable) to achieve this is through the variable thetime
, that stores the time (in seconds) spent reviewing the cards (the function
mw.col.db.first(
"""select count(), sum(time)/1000 from revlog where id > ?""",
(mw.col.sched.dayCutoff - 86400) * 1000)[1]
does the same).
This is what I have in mind:
-
Every “X” minutes I really spent studying, a dialog dialog box opens and asks if I want to take a break.
-
If I click the button “Yes”, it opens the Deck Browser, if I click “No”, it continues displaying the Reviewer until it’s time to show the dialog box again.
-
Repeat this “N” times or until I finish all the reviews scheduled for the current day (If there’s still some cards due after “N” repetitions, ask me if I want the timer to keep working. If I finish all the reviews before “N” repetitions, stop the timer and show a dialog box congratulating me for being so efficient).
Again, I don’t know how to do it.
Edit: Just learned about Timebox. So, this problem is solved for me.
Can you help me with any of this?