mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-06 15:44:49 +08:00
Fixes Inspect page issues, Fixed space in Server<id> string when default name was in use.
This commit is contained in:
parent
150c4825fd
commit
a2d7e6a3b2
@ -295,7 +295,7 @@ public class SessionsTable extends UserIDTable {
|
|||||||
try {
|
try {
|
||||||
statement = prepareStatement("SELECT " +
|
statement = prepareStatement("SELECT " +
|
||||||
"(SUM(" + columnSessionEnd + ") - SUM(" + columnSessionStart + ")) as playtime, " +
|
"(SUM(" + columnSessionEnd + ") - SUM(" + columnSessionStart + ")) as playtime, " +
|
||||||
columnServerID + "," +
|
columnServerID +
|
||||||
" FROM " + tableName +
|
" FROM " + tableName +
|
||||||
" WHERE " + columnSessionStart + ">?" +
|
" WHERE " + columnSessionStart + ">?" +
|
||||||
" AND " + columnUserID + "=" + usersTable.statementSelectID);
|
" AND " + columnUserID + "=" + usersTable.statementSelectID);
|
||||||
|
@ -101,10 +101,13 @@ public class InspectPageParser {
|
|||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
int sessionCountDay = sessionsDay.size();
|
int sessionCountDay = sessionsDay.size();
|
||||||
int sessionCountWeek = sessionsDay.size();
|
int sessionCountWeek = sessionsWeek.size();
|
||||||
long playtimeDay = AnalysisUtils.getTotalPlaytime(sessionsDay);
|
long playtimeDay = AnalysisUtils.getTotalPlaytime(sessionsDay);
|
||||||
long playtimeWeek = AnalysisUtils.getTotalPlaytime(sessionsWeek);
|
long playtimeWeek = AnalysisUtils.getTotalPlaytime(sessionsWeek);
|
||||||
|
|
||||||
|
addValue("sessionLengthLongestDay", FormatUtils.formatTimeAmount(sessionsDay.get(0).getLength()));
|
||||||
|
addValue("sessionLengthLongestWeek", FormatUtils.formatTimeAmount(sessionsWeek.get(0).getLength()));
|
||||||
|
|
||||||
addValue("sessionCountDay", sessionCountDay);
|
addValue("sessionCountDay", sessionCountDay);
|
||||||
addValue("sessionCountWeek", sessionCountWeek);
|
addValue("sessionCountWeek", sessionCountWeek);
|
||||||
addValue("playtimeDay", FormatUtils.formatTimeAmount(playtimeDay));
|
addValue("playtimeDay", FormatUtils.formatTimeAmount(playtimeDay));
|
||||||
@ -130,7 +133,9 @@ public class InspectPageParser {
|
|||||||
addValue("lastSeen", FormatUtils.formatTimeAmount(playTime));
|
addValue("lastSeen", FormatUtils.formatTimeAmount(playTime));
|
||||||
|
|
||||||
String puchCardData = PunchCardGraphCreator.createDataSeries(allSessions);
|
String puchCardData = PunchCardGraphCreator.createDataSeries(allSessions);
|
||||||
List<Session> sessionsInLengthOrder = allSessions.stream().sorted(new SessionLengthComparator()).collect(Collectors.toList());
|
List<Session> sessionsInLengthOrder = allSessions.stream()
|
||||||
|
.sorted(new SessionLengthComparator())
|
||||||
|
.collect(Collectors.toList());
|
||||||
if (sessionsInLengthOrder.isEmpty()) {
|
if (sessionsInLengthOrder.isEmpty()) {
|
||||||
addValue("sessionLengthMedian", "No Sessions");
|
addValue("sessionLengthMedian", "No Sessions");
|
||||||
addValue("sessionLengthLongest", "No Sessions");
|
addValue("sessionLengthLongest", "No Sessions");
|
||||||
@ -163,7 +168,7 @@ public class InspectPageParser {
|
|||||||
String banned = isBanned ? "Banned" : "";
|
String banned = isBanned ? "Banned" : "";
|
||||||
String op = isOP ? "Operator (OP)" : "";
|
String op = isOP ? "Operator (OP)" : "";
|
||||||
|
|
||||||
addValue("playerclassification", HtmlStructure.separateWithDots(active, banned, op));
|
addValue("playerClassification", HtmlStructure.separateWithDots(active, banned, op));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addValue(String placeholder, Serializable value) {
|
private void addValue(String placeholder, Serializable value) {
|
||||||
|
@ -11,6 +11,6 @@ public class SessionLengthComparator implements Comparator<Session> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compare(Session s1, Session s2) {
|
public int compare(Session s1, Session s2) {
|
||||||
return Long.compare(s1.getLength(), s2.getLength());
|
return -Long.compare(s1.getLength(), s2.getLength());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,6 @@ public class SessionStartComparator implements Comparator<Session> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compare(Session s1, Session s2) {
|
public int compare(Session s1, Session s2) {
|
||||||
return Long.compare(s1.getSessionStart(), s2.getSessionStart());
|
return -Long.compare(s1.getSessionStart(), s2.getSessionStart());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,6 @@ public class StringLengthComparator implements Comparator<String> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compare(String o1, String o2) {
|
public int compare(String o1, String o2) {
|
||||||
return -Integer.compare(o1.length(), o2.length());
|
return Long.compare(o1.length(), o2.length());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -48,10 +48,8 @@ public class HtmlStructure {
|
|||||||
}
|
}
|
||||||
builder.append("• ");
|
builder.append("• ");
|
||||||
builder.append(element);
|
builder.append(element);
|
||||||
if (i < elements.length - 1) {
|
|
||||||
builder.append("<br>");
|
builder.append("<br>");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return builder.toString();
|
return builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ public class ActionsTableCreator {
|
|||||||
long date = action.getDate();
|
long date = action.getDate();
|
||||||
|
|
||||||
html.append(Html.TABLELINE_3_CUSTOMKEY_1.parse(
|
html.append(Html.TABLELINE_3_CUSTOMKEY_1.parse(
|
||||||
String.valueOf(date), FormatUtils.formatTimeStamp(date),
|
String.valueOf(date), FormatUtils.formatTimeStampYear(date),
|
||||||
action.getDoneAction().toString(),
|
action.getDoneAction().toString(),
|
||||||
action.getAdditionalInfo()
|
action.getAdditionalInfo()
|
||||||
));
|
));
|
||||||
|
@ -35,6 +35,7 @@ public class ComparatorTest {
|
|||||||
List<Session> test = RandomData.randomSessions();
|
List<Session> test = RandomData.randomSessions();
|
||||||
List<Long> longValues = test.stream().map(Session::getSessionStart).collect(Collectors.toList());
|
List<Long> longValues = test.stream().map(Session::getSessionStart).collect(Collectors.toList());
|
||||||
longValues.sort(Long::compare);
|
longValues.sort(Long::compare);
|
||||||
|
Collections.reverse(longValues);
|
||||||
test.sort(new SessionStartComparator());
|
test.sort(new SessionStartComparator());
|
||||||
List<Long> afterSort = test.stream().map(Session::getSessionStart).collect(Collectors.toList());
|
List<Long> afterSort = test.stream().map(Session::getSessionStart).collect(Collectors.toList());
|
||||||
assertEquals(longValues, afterSort);
|
assertEquals(longValues, afterSort);
|
||||||
|
Loading…
Reference in New Issue
Block a user