Merge pull request #1992 from mfietz/issue/1961-statistics-incomplete

Fix statistics
This commit is contained in:
Martin Fietz 2016-06-19 01:58:51 +02:00 committed by GitHub
commit e7ab27fbdf
2 changed files with 5 additions and 3 deletions

View File

@ -949,8 +949,12 @@ public final class DBReader {
continue;
}
// played duration used to be reset when the item is added to the playback history
if(media.getPlaybackCompletionDate() != null) {
feedPlayedTime += media.getDuration() / 1000;
}
feedPlayedTime += media.getPlayedDuration() / 1000;
if(media.getPlayedDuration() > 0) {
if (media.getPlaybackCompletionDate() != null || media.getPlayedDuration() > 0) {
episodesStarted++;
}
feedTotalTime += media.getDuration() / 1000;

View File

@ -272,8 +272,6 @@ public class DBWriter {
return dbExec.submit(() -> {
Log.d(TAG, "Adding new item to playback history");
media.setPlaybackCompletionDate(new Date());
// reset played_duration to 0 so that it behaves correctly when the episode is played again
media.setPlayedDuration(0);
PodDBAdapter adapter = PodDBAdapter.getInstance();
adapter.open();