Class NetworkActivityIndexQueries
Old formula for activity index was not linear and difficult to turn into a query due to conditional multipliers. Thus a new formula was written.
T
- Time played after someone is considered active on a particular week
t1, t2, t3
- Time played that week
Activity index takes into account last 3 weeks.
Activity for a single week is calculated using A(t) = (1 / (pi/2 * (t/T) + 1))
.
A(t) is based on function f(x) = 1 / (x + 1), which has property f(0) = 1, decreasing from there, but not in a straight line.
You can see the function plotted here
To fine tune the curve pi/2 is used since it felt like a good curve.
Activity index A is calculated by using the formula:
A = 5 - 5 * [A(t1) + A(t2) + A(t3)] / 3
New Limits for A would thus be
< 1: Inactive
> 1: Irregular
> 2: Regular
> 3: Active
> 3.75: Very Active
-
Method Summary
Modifier and TypeMethodDescriptionstatic Query
<Map<Integer, ActivityIndex>> activityIndexForAllPlayers
(long date, long playtimeThreshold) static Query
<Collection<ActivityIndex>> activityIndexForNewPlayers
(long after, long before, Long threshold) static Query
<ActivityIndex> averageActivityIndexForRetainedPlayers
(long after, long before, Long threshold) averageAFKPerRegularPlayer
(long after, long before, Long threshold) averagePlaytimePerRegularPlayer
(long after, long before, Long threshold) averageSessionLengthPerRegularPlayer
(long after, long before, Long threshold) countNewPlayersTurnedRegular
(long after, long before, Long threshold) countRegularPlayersTurnedInactive
(long start, long end, Long threshold) fetchActivityGroupCount
(long date, long playtimeThreshold, double above, double below) fetchActivityIndexGroupingsOn
(long date, long threshold) fetchActivityIndexGroupingsOn
(long date, long threshold, Collection<Integer> userIds, List<ServerUUID> serverUUIDs) fetchRegularPlayerCount
(long date, long playtimeThreshold) static String
static String
selectActivityIndexSQL
(Collection<ServerUUID> onServers) static void
setSelectActivityIndexSQLParameters
(PreparedStatement statement, int index, long playtimeThreshold, long date)
-
Method Details
-
fetchRegularPlayerCount
-
selectActivityIndexSQL
-
selectActivityIndexSQL
-
setSelectActivityIndexSQLParameters
public static void setSelectActivityIndexSQLParameters(PreparedStatement statement, int index, long playtimeThreshold, long date) throws SQLException - Throws:
SQLException
-
fetchActivityGroupCount
-
fetchActivityIndexGroupingsOn
-
fetchActivityIndexGroupingsOn
public static Query<Map<String,Integer>> fetchActivityIndexGroupingsOn(long date, long threshold, Collection<Integer> userIds, List<ServerUUID> serverUUIDs) -
countNewPlayersTurnedRegular
-
countRegularPlayersTurnedInactive
public static Query<Integer> countRegularPlayersTurnedInactive(long start, long end, Long threshold) - Parameters:
start
- Start of the tracking, those regular will be counted here.end
- End of the tracking, those inactive will be count here.threshold
- Playtime threshold- Returns:
- Query how many players went from regular to inactive in a span of time.
-
averagePlaytimePerRegularPlayer
-
averageSessionLengthPerRegularPlayer
-
averageAFKPerRegularPlayer
-
activityIndexForNewPlayers
public static Query<Collection<ActivityIndex>> activityIndexForNewPlayers(long after, long before, Long threshold) -
averageActivityIndexForRetainedPlayers
public static Query<ActivityIndex> averageActivityIndexForRetainedPlayers(long after, long before, Long threshold) -
activityIndexForAllPlayers
public static Query<Map<Integer,ActivityIndex>> activityIndexForAllPlayers(long date, long playtimeThreshold)
-