mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-08-20 19:52:45 +02:00
Added AFK time to Inspect page (Sessions, Overview)
This commit is contained in:
parent
e6874626bf
commit
4be90f69f2
|
@ -434,6 +434,10 @@ public class PlayerProfile {
|
|||
return oppedOnServers.contains(ServerInfo.getServerUUID());
|
||||
}
|
||||
|
||||
public static long getAFKTime(Stream<Session> sessions) {
|
||||
return sessions.mapToLong(Session::getAfkLength).sum();
|
||||
}
|
||||
|
||||
public void calculateWorldTimesPerServer() {
|
||||
if (worldTimesMap.containsKey(ServerInfo.getServerUUID())) {
|
||||
return;
|
||||
|
|
|
@ -149,6 +149,11 @@ public class InspectPage extends Page {
|
|||
long playtimeWeek = PlayerProfile.getPlaytime(sessionsWeek.stream());
|
||||
long playtimeMonth = PlayerProfile.getPlaytime(sessionsMonth.stream());
|
||||
|
||||
long afk = PlayerProfile.getAFKTime(allSessions.stream());
|
||||
long afkDay = PlayerProfile.getAFKTime(sessionsDay.stream());
|
||||
long afkWeek = PlayerProfile.getAFKTime(sessionsWeek.stream());
|
||||
long afkMonth = PlayerProfile.getAFKTime(sessionsMonth.stream());
|
||||
|
||||
long longestSession = PlayerProfile.getLongestSession(allSessions.stream());
|
||||
long longestSessionDay = PlayerProfile.getLongestSession(sessionsDay.stream());
|
||||
long longestSessionWeek = PlayerProfile.getLongestSession(sessionsWeek.stream());
|
||||
|
@ -174,6 +179,11 @@ public class InspectPage extends Page {
|
|||
addValue("playtimeWeek", playtimeWeek > 0L ? FormatUtils.formatTimeAmount(playtimeWeek) : "-");
|
||||
addValue("playtimeMonth", playtimeMonth > 0L ? FormatUtils.formatTimeAmount(playtimeMonth) : "-");
|
||||
|
||||
addValue("afkTotal", afk > 0L ? FormatUtils.formatTimeAmount(afk) : "-");
|
||||
addValue("afkDay", afkDay > 0L ? FormatUtils.formatTimeAmount(afkDay) : "-");
|
||||
addValue("afkWeek", afkWeek > 0L ? FormatUtils.formatTimeAmount(afkWeek) : "-");
|
||||
addValue("afkMonth", afkMonth > 0L ? FormatUtils.formatTimeAmount(afkMonth) : "-");
|
||||
|
||||
addValue("sessionLengthLongest", longestSession > 0L ? FormatUtils.formatTimeAmount(longestSession) : "-");
|
||||
addValue("sessionLongestDay", longestSessionDay > 0L ? FormatUtils.formatTimeAmount(longestSessionDay) : "-");
|
||||
addValue("sessionLongestWeek", longestSessionWeek > 0L ? FormatUtils.formatTimeAmount(longestSessionWeek) : "-");
|
||||
|
|
|
@ -53,6 +53,7 @@ public class ServerAccordion extends AbstractAccordion {
|
|||
|
||||
List<Session> sessions = profile.getSessions(serverUUID);
|
||||
long playtime = PlayerProfile.getPlaytime(sessions.stream());
|
||||
long afk = PlayerProfile.getAFKTime(sessions.stream());
|
||||
int sessionCount = sessions.size();
|
||||
long avgSession = MathUtils.averageLong(playtime, sessionCount);
|
||||
long sessionMedian = PlayerProfile.getSessionMedian(sessions.stream());
|
||||
|
@ -81,6 +82,7 @@ public class ServerAccordion extends AbstractAccordion {
|
|||
String leftSide = new AccordionElementContentBuilder()
|
||||
.addRowBold("teal", "calendar-check-o", "Sessions", sessionCount)
|
||||
.addRowBold("green", "clock-o", "Server Playtime", play)
|
||||
.addRowBold("grey", "clock-o", "Time AFK", afk)
|
||||
.addRowBold("teal", "clock-o", "Longest Session", longest)
|
||||
.addRowBold("teal", "clock-o", "Session Median", median)
|
||||
.addBreak()
|
||||
|
|
|
@ -65,6 +65,7 @@ public class SessionTabStructureCreator {
|
|||
String sessionStart = FormatUtils.formatTimeStampYear(session.getSessionStart());
|
||||
long endOfSession = session.getSessionEnd();
|
||||
String sessionLength = endOfSession == -1 ? "Online" : FormatUtils.formatTimeAmount(session.getLength());
|
||||
String afk = (endOfSession == -1 ? "(Inaccurate) " : "") + FormatUtils.formatTimeAmount(session.getAfkLength());
|
||||
String sessionEnd = endOfSession == -1 ? "Online" : FormatUtils.formatTimeStampYear(endOfSession);
|
||||
|
||||
int playerKillCount = session.getPlayerKills().size();
|
||||
|
@ -116,6 +117,8 @@ public class SessionTabStructureCreator {
|
|||
.append("<li><i class=\"col-teal fa fa-clock-o\"></i> Session Ended<span class=\"pull-right\"><b>").append(sessionEnd).append("</b></span></li>")
|
||||
// Length
|
||||
.append("<li><i class=\"col-teal fa fa-clock-o\"></i> Session Length<span class=\"pull-right\"><b>").append(sessionLength).append("</b></span></li>")
|
||||
// AFK
|
||||
.append("<li><i class=\"col-grey fa fa-clock-o\"></i> AFK<span class=\"pull-right\"><b>").append(afk).append("</b></span></li>")
|
||||
// Server
|
||||
.append("<li><i class=\"col-light-green fa fa-server\"></i> Server<span class=\"pull-right\"><b>").append(serverName).append("</b></span></li>")
|
||||
.append("<li></li>")
|
||||
|
|
Loading…
Reference in New Issue
Block a user