View Single Post
Old 09-21-2025, 09:45 PM   #924
thiago.eec
Wizard
thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.
 
Posts: 1,322
Karma: 1436993
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite, Kindle Oasis
Quote:
Originally Posted by Feoras View Post
Thank you so much for your work, adapting my proposal and making it even better.

Sadly it is not working for me. I think this might be a local thing.


The issue I could find out is, that the month names are lower case (from daily_page_count):


But inside get_month_stats function the read_pages_month_count is initialized from m

However, these abbr are capital case.

This results in the for loop:
for month in daily_page_count to insert new month into read_pages_month_count instead of replacing the existing once.

This is how read_pages_month_count looks like after:


So either daily_page_count should not be lower case or month_page_stats has to be (but month_book_stats is not lower case either).

To be consistent I modified daily_page_count to be capitalized only in the function get_month_stats to be consistent with everything else:


Now it works!
Pages are shown correctly and books read when hovering if the settings is set or vise verse if not.

Sorry for the long post and thanks again for implementing this feature <3
Thanks so much for finding the problem. I tried appling your fix and noticed it stoped working for me. Then I checked the 'month_abbr' output. Turns out it's lowercase in pt-BR. God knows why!

So, to make sure it will always work, the best thing to do is to keep everything lowercase. So I did this:
Code:
read_pages_month_count = {k.lower(): v for k, v in read_pages_month_count.items()}
Now it is compatible with 'daily_page_count()'.

Please test and confirm it works.

Last edited by thiago.eec; 09-22-2025 at 10:44 AM. Reason: New test version
thiago.eec is offline   Reply With Quote