Implemented median first session length

Affects issues:
- Close #1211
This commit is contained in:
Rsl1122 2019-11-07 13:01:23 +02:00
parent f641c44bf2
commit 4bcf2141d9
3 changed files with 16 additions and 6 deletions

View File

@ -219,11 +219,17 @@ public class OnlineActivityOverviewJSONParser implements ServerTabJSONParser<Map
SessionsMutator firstSessionsBefore = firstSessions.filterSessionsBetween(monthAgo, halfMonthAgo);
SessionsMutator firstSessionsAfter = firstSessions.filterSessionsBetween(halfMonthAgo, now);
long avgSessionLength = firstSessions.toAverageSessionLength();
long avgSessionLengthBefore = firstSessionsBefore.toAverageSessionLength();
long avgSessionLengthAfter = firstSessionsAfter.toAverageSessionLength();
insights.put("first_session_length_avg", timeAmountFormatter.apply(avgSessionLength));
insights.put("first_session_length_trend", new Trend(avgSessionLengthBefore, avgSessionLengthAfter, false, timeAmountFormatter));
long avgFirstSessionLength = firstSessions.toAverageSessionLength();
long avgFirstSessionLengthBefore = firstSessionsBefore.toAverageSessionLength();
long avgFirstSessionLengthAfter = firstSessionsAfter.toAverageSessionLength();
insights.put("first_session_length_avg", timeAmountFormatter.apply(avgFirstSessionLength));
insights.put("first_session_length_trend", new Trend(avgFirstSessionLengthBefore, avgFirstSessionLengthAfter, false, timeAmountFormatter));
long medianFirstSessionLength = firstSessions.toMedianSessionLength();
long medianFirstSessionLengthBefore = firstSessionsBefore.toMedianSessionLength();
long medianFirstSessionLengthAfter = firstSessionsAfter.toMedianSessionLength();
insights.put("first_session_length_median", timeAmountFormatter.apply(medianFirstSessionLength));
insights.put("first_session_length_median_trend", new Trend(medianFirstSessionLengthBefore, medianFirstSessionLengthAfter, false, timeAmountFormatter));
int lonelyJoins = playersOnlineResolver.findLonelyJoins(sessions.toSessionStarts());
int loneJoinsBefore = playersOnlineResolver.findLonelyJoins(sessions.filterSessionsBetween(monthAgo, halfMonthAgo).toSessionStarts());

View File

@ -176,6 +176,7 @@ function loadOnlineActivityOverviewValues(json, error) {
$(element).find('#data_players_first_join_avg').replaceWith(data.players_first_join_avg + smallTrend(data.players_first_join_trend));
$(element).find('#data_first_session_length_avg').replaceWith(data.first_session_length_avg + smallTrend(data.first_session_length_trend));
$(element).find('#data_first_session_length_median').replaceWith(data.first_session_length_median + smallTrend(data.first_session_length_median_trend));
$(element).find('#data_lone_joins').replaceWith(data.lone_joins + smallTrend(data.lone_joins_trend));
$(element).find('#data_lone_new_joins').replaceWith(data.lone_new_joins + smallTrend(data.lone_new_joins_trend))
}

View File

@ -472,9 +472,12 @@
first
join<span class="float-right"><b><span
id="data_players_first_join_avg"></span></b></span></p>
<p><i class="col-light-green fa fa-fw fa-user-clock"></i> First session
<p><i class="col-light-green fa fa-fw fa-user-clock"></i> Average First session
length<span class="float-right"><b><span
id="data_first_session_length_avg"></span></b></span></p>
<p><i class="col-light-green fa fa-fw fa-user-clock"></i> Median First session
length<span class="float-right"><b><span
id="data_first_session_length_median"></span></b></span></p>
<p><i class="col-teal far fa-fw fa-calendar"></i> Lone joins<span
class="float-right"><b><span id="data_lone_joins"></span></b>
</span></p>