diff options
author | Martin Fietz <Martin.Fietz@gmail.com> | 2016-06-19 01:58:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-19 01:58:51 +0200 |
commit | e7ab27fbdf96416621e9f74d7d2a83c4054c7c61 (patch) | |
tree | fb44adc138ee495a33ce92b74f7b7e0044cb5d73 /core/src | |
parent | 78ae4f620bd0c6f8c06bb7b48ad3f7d38e73cf5c (diff) | |
parent | fd05940d673e9e1d5c3a0482a0f9b67f02554085 (diff) | |
download | AntennaPod-e7ab27fbdf96416621e9f74d7d2a83c4054c7c61.zip |
Merge pull request #1992 from mfietz/issue/1961-statistics-incomplete
Fix statistics
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java | 6 | ||||
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/storage/DBWriter.java | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java b/core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java index 869ec5f9d..9a7b2c852 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/DBReader.java @@ -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; diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/DBWriter.java b/core/src/main/java/de/danoeh/antennapod/core/storage/DBWriter.java index 6f299ee35..50bcd64cb 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/DBWriter.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/DBWriter.java @@ -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(); |