Class ActivityIndexQueries
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
<Collection<ActivityIndex>> activityIndexForNewPlayers
(long after, long before, ServerUUID serverUUID, Long threshold) static Query
<ActivityIndex> averageActivityIndexForNonRetainedPlayers
(long after, long before, ServerUUID serverUUID, Long threshold) static Query
<ActivityIndex> averageActivityIndexForRetainedPlayers
(long after, long before, ServerUUID serverUUID, Long threshold) averageAFKPerRegularPlayer
(long after, long before, ServerUUID serverUUID, Long threshold) averagePlaytimePerRegularPlayer
(long after, long before, ServerUUID serverUUID, Long threshold) averageSessionLengthPerRegularPlayer
(long after, long before, ServerUUID serverUUID, Long threshold) countNewPlayersTurnedRegular
(long after, long before, ServerUUID serverUUID, Long threshold) countRegularPlayersTurnedInactive
(long start, long end, ServerUUID serverUUID, Long threshold) fetchActivityGroupCount
(long date, ServerUUID serverUUID, long playtimeThreshold, double above, double below) fetchActivityIndexGroupingsOn
(long date, ServerUUID serverUUID, long threshold) fetchRegularPlayerCount
(long date, ServerUUID serverUUID, long playtimeThreshold) static String
static void
setSelectActivityIndexSQLParameters
(PreparedStatement statement, int index, long playtimeThreshold, ServerUUID serverUUID, long date)
-
Method Details
-
fetchRegularPlayerCount
public static Query<Integer> fetchRegularPlayerCount(long date, ServerUUID serverUUID, long playtimeThreshold) -
selectActivityIndexSQL
-
setSelectActivityIndexSQLParameters
public static void setSelectActivityIndexSQLParameters(PreparedStatement statement, int index, long playtimeThreshold, ServerUUID serverUUID, long date) throws SQLException - Throws:
SQLException
-
fetchActivityGroupCount
public static Query<Integer> fetchActivityGroupCount(long date, ServerUUID serverUUID, long playtimeThreshold, double above, double below) -
fetchActivityIndexGroupingsOn
public static Query<Map<String,Integer>> fetchActivityIndexGroupingsOn(long date, ServerUUID serverUUID, long threshold) -
countNewPlayersTurnedRegular
public static Query<Integer> countNewPlayersTurnedRegular(long after, long before, ServerUUID serverUUID, Long threshold) -
countRegularPlayersTurnedInactive
public static Query<Integer> countRegularPlayersTurnedInactive(long start, long end, ServerUUID serverUUID, 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.serverUUID
- UUID of the server.threshold
- Playtime threshold- Returns:
- Query how many players went from regular to inactive in a span of time.
-
averagePlaytimePerRegularPlayer
public static Query<Long> averagePlaytimePerRegularPlayer(long after, long before, ServerUUID serverUUID, Long threshold) -
averageSessionLengthPerRegularPlayer
public static Query<Long> averageSessionLengthPerRegularPlayer(long after, long before, ServerUUID serverUUID, Long threshold) -
averageAFKPerRegularPlayer
public static Query<Long> averageAFKPerRegularPlayer(long after, long before, ServerUUID serverUUID, Long threshold) -
activityIndexForNewPlayers
public static Query<Collection<ActivityIndex>> activityIndexForNewPlayers(long after, long before, ServerUUID serverUUID, Long threshold) -
averageActivityIndexForRetainedPlayers
public static Query<ActivityIndex> averageActivityIndexForRetainedPlayers(long after, long before, ServerUUID serverUUID, Long threshold) -
averageActivityIndexForNonRetainedPlayers
public static Query<ActivityIndex> averageActivityIndexForNonRetainedPlayers(long after, long before, ServerUUID serverUUID, Long threshold)
-