Skip to content
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

Merged

Conversation

ippschi
Copy link
Contributor

@ippschi ippschi commented Apr 18, 2021

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.

@ippschi
Copy link
Contributor Author

ippschi commented Apr 18, 2021

@UweTrottmann Can you please start reviewing and help me with the translations?

@UweTrottmann
Copy link
Owner

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.

@ippschi ippschi marked this pull request as ready for review April 26, 2021 08:30
@ippschi
Copy link
Contributor Author

ippschi commented Apr 26, 2021

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)")
Copy link
Owner

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?

@UweTrottmann
Copy link
Owner

Great, thank you for making the changes and your SQL magic! Will be in the next update.

@UweTrottmann UweTrottmann added this to the SeriesGuide 59 milestone May 7, 2021
@UweTrottmann UweTrottmann merged commit afa5e2a into UweTrottmann:dev May 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants