@Test public void testDeadlineCountdownValueWithMinutesLeft() { final Date date = DateTime.now().toDate(); final MutableDateTime currentDate = new MutableDateTime(date); currentDate.addSeconds(300); final Reward rewardWithMinutesRemaining = RewardFactory.reward().toBuilder() .endsAt(currentDate.toDateTime()) .build(); assertEquals(RewardUtils.deadlineCountdownValue(rewardWithMinutesRemaining), 5); }
public static int deadlineCountdownValue(final @NonNull Reward reward) { final Long seconds = timeInSecondsUntilDeadline(reward); if (seconds <= 120.0) { return seconds.intValue(); } else if (seconds <= 120.0 * 60.0) { return (int) Math.floor(seconds / 60.0); } else if (seconds < 72.0 * 60.0 * 60.0) { return (int) Math.floor(seconds / 60.0 / 60.0); } return (int) Math.floor(seconds / 60.0 / 60.0 / 24.0); }
RewardUtils { public static int deadlineCountdownValue(final @NonNull Reward reward) { final Long seconds = timeInSecondsUntilDeadline(reward); if (seconds <= 120.0) { return seconds.intValue(); } else if (seconds <= 120.0 * 60.0) { return (int) Math.floor(seconds / 60.0); } else if (seconds < 72.0 * 60.0 * 60.0) { return (int) Math.floor(seconds / 60.0 / 60.0); } return (int) Math.floor(seconds / 60.0 / 60.0 / 24.0); } }
RewardUtils { public static int deadlineCountdownValue(final @NonNull Reward reward) { final Long seconds = timeInSecondsUntilDeadline(reward); if (seconds <= 120.0) { return seconds.intValue(); } else if (seconds <= 120.0 * 60.0) { return (int) Math.floor(seconds / 60.0); } else if (seconds < 72.0 * 60.0 * 60.0) { return (int) Math.floor(seconds / 60.0 / 60.0); } return (int) Math.floor(seconds / 60.0 / 60.0 / 24.0); } private  RewardUtils(); }
RewardUtils { public static int deadlineCountdownValue(final @NonNull Reward reward) { final Long seconds = timeInSecondsUntilDeadline(reward); if (seconds <= 120.0) { return seconds.intValue(); } else if (seconds <= 120.0 * 60.0) { return (int) Math.floor(seconds / 60.0); } else if (seconds < 72.0 * 60.0 * 60.0) { return (int) Math.floor(seconds / 60.0 / 60.0); } return (int) Math.floor(seconds / 60.0 / 60.0 / 24.0); } private  RewardUtils(); static boolean hasBackers(final @NonNull Reward reward); static boolean isAvailable(final @NonNull Project project, final @NonNull Reward reward); static boolean isExpired(final @NonNull Reward reward); static boolean isItemized(final @NonNull Reward reward); static boolean isLimited(final @NonNull Reward reward); static boolean isLimitReached(final @NonNull Reward reward); static boolean isNoReward(final @NonNull Reward reward); static boolean isReward(final @NonNull Reward reward); static boolean isShippable(final @NonNull Reward reward); static boolean isTimeLimited(final @NonNull Reward reward); static @NonNull String deadlineCountdownDetail(final @NonNull Reward reward, final @NonNull Context context,
    final @NonNull KSString ksString); static @NonNull String deadlineCountdownUnit(final @NonNull Reward reward, final @NonNull Context context); static Pair<Integer, String> shippingSummary(final @NonNull Reward reward); static @NonNull Long timeInSecondsUntilDeadline(final @NonNull Reward reward); static int deadlineCountdownValue(final @NonNull Reward reward); static Double rewardAmountByVariant(final OptimizelyExperiment.Variant variant, final Reward reward, final Integer minPledge); }
RewardUtils { public static int deadlineCountdownValue(final @NonNull Reward reward) { final Long seconds = timeInSecondsUntilDeadline(reward); if (seconds <= 120.0) { return seconds.intValue(); } else if (seconds <= 120.0 * 60.0) { return (int) Math.floor(seconds / 60.0); } else if (seconds < 72.0 * 60.0 * 60.0) { return (int) Math.floor(seconds / 60.0 / 60.0); } return (int) Math.floor(seconds / 60.0 / 60.0 / 24.0); } private  RewardUtils(); static boolean hasBackers(final @NonNull Reward reward); static boolean isAvailable(final @NonNull Project project, final @NonNull Reward reward); static boolean isExpired(final @NonNull Reward reward); static boolean isItemized(final @NonNull Reward reward); static boolean isLimited(final @NonNull Reward reward); static boolean isLimitReached(final @NonNull Reward reward); static boolean isNoReward(final @NonNull Reward reward); static boolean isReward(final @NonNull Reward reward); static boolean isShippable(final @NonNull Reward reward); static boolean isTimeLimited(final @NonNull Reward reward); static @NonNull String deadlineCountdownDetail(final @NonNull Reward reward, final @NonNull Context context,
    final @NonNull KSString ksString); static @NonNull String deadlineCountdownUnit(final @NonNull Reward reward, final @NonNull Context context); static Pair<Integer, String> shippingSummary(final @NonNull Reward reward); static @NonNull Long timeInSecondsUntilDeadline(final @NonNull Reward reward); static int deadlineCountdownValue(final @NonNull Reward reward); static Double rewardAmountByVariant(final OptimizelyExperiment.Variant variant, final Reward reward, final Integer minPledge);  }