diff options
author | orionlee <orionlee@yahoo.com> | 2018-11-14 12:01:40 -0800 |
---|---|---|
committer | orionlee <orionlee@yahoo.com> | 2019-01-04 10:32:14 -0800 |
commit | 4ff5690341d6969f73010003d28b7a9e0d31f0c8 (patch) | |
tree | b9dc68cb754297bcf81ce86f465ebe3191944bb8 /core/src/main/java/de | |
parent | 1bb0694403460aedf0bd7a2839fe5d4e19842a6b (diff) | |
download | AntennaPod-4ff5690341d6969f73010003d28b7a9e0d31f0c8.zip |
episode cleanup 12 hour option: add unit test to prepare for using hours
rather than days as data structure
Diffstat (limited to 'core/src/main/java/de')
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/storage/APCleanupAlgorithm.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/storage/APCleanupAlgorithm.java b/core/src/main/java/de/danoeh/antennapod/core/storage/APCleanupAlgorithm.java index 6d71bbc9f..3bec93d29 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/storage/APCleanupAlgorithm.java +++ b/core/src/main/java/de/danoeh/antennapod/core/storage/APCleanupAlgorithm.java @@ -80,12 +80,17 @@ public class APCleanupAlgorithm extends EpisodeCleanupAlgorithm { return counter; } + @VisibleForTesting + Date calcMostRecentDateForDeletion(@NonNull Date currentDate) { + return minusDays(currentDate, numberOfDaysAfterPlayback); + } + @NonNull private List<FeedItem> getCandidates() { List<FeedItem> candidates = new ArrayList<>(); List<FeedItem> downloadedItems = DBReader.getDownloadedItems(); - Date mostRecentDateForDeletion = minusDays(new Date(), numberOfDaysAfterPlayback); + Date mostRecentDateForDeletion = calcMostRecentDateForDeletion(new Date()); for (FeedItem item : downloadedItems) { if (item.hasMedia() && item.getMedia().isDownloaded() |