diff --git a/source/net/filebot/ui/SupportDialog.java b/source/net/filebot/ui/SupportDialog.java index d17f87c4..dd678c22 100644 --- a/source/net/filebot/ui/SupportDialog.java +++ b/source/net/filebot/ui/SupportDialog.java @@ -86,15 +86,17 @@ public enum SupportDialog { }; public boolean feelingLucky(int sessionRenameCount, int totalRenameCount, int currentRevision, int lastSupportRevision, int supportRevisionCount) { - // ask only once per revision - if (currentRevision <= lastSupportRevision && this == AppStoreReview) { + // ask for reviews only once per revision + if (currentRevision <= lastSupportRevision && isAppStore()) { return false; } - if (sessionRenameCount >= 2000) { + // always lucky if many files are processed in a single session + if (sessionRenameCount >= 2000 * Math.pow(2, supportRevisionCount)) { return true; } + // sometimes lucky if many files have been processed over time return totalRenameCount >= 1000 * Math.pow(4, supportRevisionCount) && Math.random() >= 0.777; } diff --git a/test/net/filebot/ui/SupportDialogTest.java b/test/net/filebot/ui/SupportDialogTest.java index 92af17db..f53d3640 100644 --- a/test/net/filebot/ui/SupportDialogTest.java +++ b/test/net/filebot/ui/SupportDialogTest.java @@ -11,10 +11,11 @@ public class SupportDialogTest { @Test public void feelingLucky() { assertTrue(SupportDialog.AppStoreReview.feelingLucky(2000, 2000, 500, 400, 0)); - assertFalse(SupportDialog.AppStoreReview.feelingLucky(2000, 2000, 400, 400, 0)); + assertFalse(SupportDialog.AppStoreReview.feelingLucky(2000, 2000, 400, 400, 1)); assertTrue(SupportDialog.Donation.feelingLucky(2000, 2000, 400, 400, 0)); assertFalse(SupportDialog.Donation.feelingLucky(100, 100, 400, 400, 0)); + assertFalse(SupportDialog.Donation.feelingLucky(2000, 2000, 400, 400, 1)); assertTrue(IntStream.range(0, 100).anyMatch(i -> SupportDialog.Donation.feelingLucky(0, 5000, 400, 400, 0))); assertFalse(IntStream.range(0, 100).anyMatch(i -> SupportDialog.Donation.feelingLucky(0, 5000, 400, 400, 2)));