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
Remember how many cards we've learned today even after re-opening the app #110
Remember how many cards we've learned today even after re-opening the app #110
Conversation
When we close the mnemosyne application and re-open it, it won't remember the number of the already memorized cards. In other words, it won't warn you if you've already learned 15 or more words. This PR aims to fix this issue and re-construct the `self._fact_ids_memorised` from the logs. We can fetch all the newly learned cards and all the forgotten but learned cards today. Combining the two, we can get the number of the learned cards today.
I need to check why the database is not set up properly during the test. The
|
It seems that checking that the DB is loaded or not satisfies the test: if not db.is_loaded():
... |
I'm not against reconstructing the memorised ids from the log, but I would only warn once per day, otherwise it seems very obtrusive. People already now complain about this warning... |
oh I didn't know this. In this case I'd only warn exactly at the On the other hand, why not adding a new configuration option, to disable warning if that is so annoying to others? To be quite honest, I find it very useful. When I try to learn more than 15, like 30, it'll backshot after 3 weeks and my retention drops drastically. |
@pbienst by the way I'm really grateful that you created this application. I'm using this for more than 2 years and I'm pretty satisfied with it. It helps a lot! with learning Japanese :) |
My pleasure! |
When saving the Settings dialog, the `reset` is alwas called, so it would trigger an alert every time when, because during the reset function, the `warned_about_too_many_cards` is reset to `warned_about_too_many_cards = False`. This fix initializes the `warned_about_too_many_cards` on the class level, and calling `reset` won`t reset it back to `False`. Also only warn when we've just reached the 15 new or forgotten words.
Add a new event type: `WARNED_TOO_MANY_CARDS` so we can query from the log table if the warning has been already shown or not. - Add test coverage
Warning on start-up would be only useful if we could alert more than once a day. If we already displayed a warning, we should never show the warning again on start-up.
Python lists are unordered, so comparing them will result in a random result. Using `sort()` will ensure that the elements are ordered so we can compare them properly. Using sort is `O(n log n)`.
@pbienst According to your comment, I made a few changes to the code:
other:
|
I'm almost ready to commit this, but I have a few minor remarks:
Thanks! |
Sure, no problem. I'll get back to you when the code is cleaned up. |
- Move sql queries to the database class - Add test coverage for the new database API functions - adjusting the variable naming to comply with the current naming scheme
@pbienst I made some changes according to your comments. Let me know if you want me to change other things. |
Thanks a lot! |
Rationale
When we close the Mnemosyne application and re-open it, it won't
remember the number of the already memorized cards. In other words, it
won't warn you if you've already learned 15 or more words.
Implementation
This PR aims to fix this issue and re-construct the
self._fact_ids_memorised
from the logs which are not that hard.We can fetch all the newly learned cards (same query as in the statistics) and all the forgotten but
learned cards today. Combining the two, we can get the number of learned cards today.
New features
Any comments are welcome.