-
-
Notifications
You must be signed in to change notification settings - Fork 400
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
Statistics for shows I've finished watching #788
Statistics for shows I've finished watching #788
Conversation
- For translation process the key must be made translatable and translations must be provided
- a show that is finished watching is one that ended and which does not has a next episode for the viewer
@UweTrottmann Can you please start reviewing and help me with the translations? |
Thanks! Great thinking, but needs to be calculated differently. E.g. when Advanced > No aired episodes is turned on, no next episode might be displayed, but there can still be already aired episodes not watched. As for UI, would put the progress bar last (below continuing). As for translation, just create a regular string (e.g. remove the non-translatable) and I'll handle this after merging. |
Thanks for your feedback. I updated my branch according to your suggestions. What to look out: The SQL query counting the shows finished watching. Excluding special episodes in the stats view will also ignore specials in the query. (If you watched/skipped all special episodes anyway, it will not differ.) This way the counting should not be affected by the "Advanced > No aired episodes" filter. I changed the UI order. New string is now translatable (but only available in English so far). |
@@ -94,6 +94,12 @@ interface SgShow2Helper { | |||
@Query("SELECT _id, series_status, series_next, series_runtime FROM sg_show") | |||
fun getStats(): List<SgShow2Stats> | |||
|
|||
@Query("SELECT count(series_id) FROM (SELECT series_id, series_status, sum(case when episode_watched = '0' then 1 else 0 end) as episodes_unwatched FROM sg_episode LEFT OUTER JOIN sg_show ON sg_episode.series_id = sg_show._id GROUP BY series_id) WHERE episodes_unwatched = 0 AND series_status IN (0, 3)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I'm a SQL noob: is the GROUP BY a performance optimization? Or am I missing something?
Great, thank you for making the changes and your SQL magic! Will be in the next update. |
Relates to #773
#773 (comment)
I'm up for discussion on this statistics enhancement. This can also be solved by joining sg_show, sg_season, and sg_episode tables and extracting more granular information than just relying on the "next episode" info from the stats object.
Also, I added a string key and I don't yet know about the process of translations. For now I marked the string key as non-translatable. This is why this is a draft pull request. New translation will probably be injected by the translation tool. I'd like to ask for help on this part.