Skip to content

Commit

Permalink
Merge pull request #612 from Automattic/task/fix-top-podcasts-ordering
Browse files Browse the repository at this point in the history
End of Year: Fix to match iOS podcasts ordering
  • Loading branch information
geekygecko authored and ashiagr committed Nov 24, 2022
1 parent 56c7211 commit 6f81075
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ class ProfileFragment : BaseFragment() {
AppTheme(theme.activeTheme) {
EndOfYearPromptCard(
onClick = {
analyticsTracker.track(AnalyticsEvent.END_OF_YEAR_PROFILE_CARD_TAPPED)
(activity as? FragmentHostListener)?.showStoriesOrAccount(StoriesSource.PROFILE.value)
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,4 +317,5 @@ enum class AnalyticsEvent(val key: String) {
END_OF_YEAR_STORY_SHARE("end_of_year_story_share"),
END_OF_YEAR_STORY_SHARED("end_of_year_story_shared"),
END_OF_YEAR_STORY_RETRY_BUTTON_TAPPED("end_of_year_story_retry_button_tapped"),
END_OF_YEAR_PROFILE_CARD_TAPPED("end_of_year_profile_card_tapped")
}
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ abstract class PodcastDao {
JOIN podcasts ON episodes.podcast_id = podcasts.uuid
WHERE episodes.last_playback_interaction_date IS NOT NULL AND episodes.last_playback_interaction_date > :fromEpochMs AND episodes.last_playback_interaction_date < :toEpochMs
GROUP BY podcast_id
ORDER BY numberOfPlayedEpisodes DESC, totalPlayedTime DESC
ORDER BY totalPlayedTime DESC, numberOfPlayedEpisodes DESC
LIMIT :limit
"""
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,7 @@ class EndOfYearManagerImpl @Inject constructor(
return episodeManager.findListenedNumbers(yearStart, yearEnd)
}

/* Returns top podcasts ordered by number of played episodes. If there's a tie on number of played episodes,
played time is checked. */
/* Returns top podcasts ordered by total played time. If there's a tie on total played time, check number of played episodes. */
override suspend fun findTopPodcastsForYear(year: Int, limit: Int): List<TopPodcast> {
return podcastManager.findTopPodcasts(yearStart, yearEnd, limit)
}
Expand Down

0 comments on commit 6f81075

Please sign in to comment.