From 08ea04214463a2864ded5cbb637ef96c0d38a869 Mon Sep 17 00:00:00 2001 From: Risto Lahtela <24460436+Rsl1122@users.noreply.github.com> Date: Sat, 9 May 2020 09:38:43 +0300 Subject: [PATCH] Fixed checkstyle & activity index precision on SQLite --- .../plan/delivery/domain/mutators/SessionsMutator.java | 2 +- .../storage/database/queries/analysis/ActivityIndexQueries.java | 2 +- .../database/queries/analysis/NetworkActivityIndexQueries.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Plan/common/src/main/java/com/djrapitops/plan/delivery/domain/mutators/SessionsMutator.java b/Plan/common/src/main/java/com/djrapitops/plan/delivery/domain/mutators/SessionsMutator.java index 991ee934a..27506fbca 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/delivery/domain/mutators/SessionsMutator.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/delivery/domain/mutators/SessionsMutator.java @@ -197,7 +197,7 @@ public class SessionsMutator { return session -> { Long start = session.getUnsafe(SessionKeys.START); long end = session.getValue(SessionKeys.END).orElse(System.currentTimeMillis()); - return (after <= end && start <= before); + return after <= end && start <= before; }; } diff --git a/Plan/common/src/main/java/com/djrapitops/plan/storage/database/queries/analysis/ActivityIndexQueries.java b/Plan/common/src/main/java/com/djrapitops/plan/storage/database/queries/analysis/ActivityIndexQueries.java index e054a1020..58915392a 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/storage/database/queries/analysis/ActivityIndexQueries.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/storage/database/queries/analysis/ActivityIndexQueries.java @@ -88,7 +88,7 @@ public class ActivityIndexQueries { String selectThreeWeeks = selectActivePlaytimeSQL + UNION_ALL + selectActivePlaytimeSQL + UNION_ALL + selectActivePlaytimeSQL; return SELECT + - "5.0 - 5.0 * AVG(1.0 / (?/2.0 * (q1.active_playtime/?) +1.0)) as activity_index," + + "5.0 - 5.0 * AVG(1.0 / (?/2.0 * (q1.active_playtime*1.0/?) +1.0)) as activity_index," + "q1." + SessionsTable.USER_UUID + FROM + '(' + selectThreeWeeks + ") q1" + GROUP_BY + "q1." + SessionsTable.USER_UUID; diff --git a/Plan/common/src/main/java/com/djrapitops/plan/storage/database/queries/analysis/NetworkActivityIndexQueries.java b/Plan/common/src/main/java/com/djrapitops/plan/storage/database/queries/analysis/NetworkActivityIndexQueries.java index d23f5a93c..0a2efa8ee 100644 --- a/Plan/common/src/main/java/com/djrapitops/plan/storage/database/queries/analysis/NetworkActivityIndexQueries.java +++ b/Plan/common/src/main/java/com/djrapitops/plan/storage/database/queries/analysis/NetworkActivityIndexQueries.java @@ -90,7 +90,7 @@ public class NetworkActivityIndexQueries { String selectThreeWeeks = selectActivePlaytimeSQL + UNION_ALL + selectActivePlaytimeSQL + UNION_ALL + selectActivePlaytimeSQL; return SELECT + - "5.0 - 5.0 * AVG(1.0 / (?/2.0 * (q1.active_playtime/?) +1.0)) as activity_index," + + "5.0 - 5.0 * AVG(1.0 / (?/2.0 * (q1.active_playtime*1.0/?) +1.0)) as activity_index," + "q1." + SessionsTable.USER_UUID + FROM + '(' + selectThreeWeeks + ") q1" + GROUP_BY + "q1." + SessionsTable.USER_UUID;