mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-03-07 17:28:03 +08:00
Fixed Overview tab oddity when player had no sessions
This commit is contained in:
parent
4cc28e3004
commit
87c5108a45
@ -178,8 +178,12 @@ public class InspectPageParser extends PageParser {
|
||||
addValue("mobKillCount", mobKillCount);
|
||||
addValue("deathCount", deathCount);
|
||||
|
||||
boolean isActive = AnalysisUtils.isActive(MiscUtils.getTime(), lastSeen, playTime, sessionCount);
|
||||
String active = isActive ? "Active" : "Inactive";
|
||||
if (userInfo != null) {
|
||||
playerClassification(userInfo, lastSeen, playTime, sessionCount);
|
||||
playerClassification(userInfo, active);
|
||||
} else {
|
||||
addValue("playerClassification", active);
|
||||
}
|
||||
|
||||
return HtmlUtils.replacePlaceholders(FileUtil.getStringFromResource("player.html"), placeHolders);
|
||||
@ -189,12 +193,10 @@ public class InspectPageParser extends PageParser {
|
||||
}
|
||||
}
|
||||
|
||||
private void playerClassification(UserInfo userInfo, long lastPlayed, long playTime, int loginTimes) {
|
||||
private void playerClassification(UserInfo userInfo, String active) {
|
||||
boolean isBanned = userInfo.isBanned();
|
||||
boolean isOP = userInfo.isOpped();
|
||||
boolean isActive = AnalysisUtils.isActive(MiscUtils.getTime(), lastPlayed, playTime, loginTimes);
|
||||
|
||||
String active = isActive ? "Active" : "Inactive";
|
||||
String banned = isBanned ? "Banned" : "";
|
||||
String op = isOP ? "Operator (OP)" : "";
|
||||
|
||||
|
@ -62,8 +62,8 @@ public class HtmlStructure {
|
||||
public static String createServerOverviewColumn(Map<String, List<Session>> sessions) {
|
||||
StringBuilder builder = new StringBuilder("<div class=\"column\">");
|
||||
if (Verify.isEmpty(sessions)) {
|
||||
return "<div class=\"box-header\"><h2><i class=\"fa fa-server\" aria-hidden=\"true\"></i> No Sessions</h2> </div>" +
|
||||
"<div class=\"box\" style=\"margin-bottom: 5px;\"><p>No sessions to calculate server specific playtime.</p></div>";
|
||||
return "<div class=\"column\"><div class=\"box-header\"><h2><i class=\"fa fa-server\" aria-hidden=\"true\"></i> No Sessions</h2> </div>" +
|
||||
"<div class=\"box\" style=\"margin-bottom: 5px;\"><p>No sessions to calculate server specific playtime.</p></div></div>";
|
||||
}
|
||||
for (Map.Entry<String, List<Session>> entry : sessions.entrySet()) {
|
||||
String serverName = entry.getKey();
|
||||
|
Loading…
Reference in New Issue
Block a user