mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-21 05:50:18 +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 {
|
||||
statement = prepareStatement("SELECT " +
|
||||
"(SUM(" + columnSessionEnd + ") - SUM(" + columnSessionStart + ")) as playtime, " +
|
||||
columnServerID + "," +
|
||||
columnServerID +
|
||||
" FROM " + tableName +
|
||||
" WHERE " + columnSessionStart + ">?" +
|
||||
" AND " + columnUserID + "=" + usersTable.statementSelectID);
|
||||
|
@ -101,10 +101,13 @@ public class InspectPageParser {
|
||||
.collect(Collectors.toList());
|
||||
|
||||
int sessionCountDay = sessionsDay.size();
|
||||
int sessionCountWeek = sessionsDay.size();
|
||||
int sessionCountWeek = sessionsWeek.size();
|
||||
long playtimeDay = AnalysisUtils.getTotalPlaytime(sessionsDay);
|
||||
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("sessionCountWeek", sessionCountWeek);
|
||||
addValue("playtimeDay", FormatUtils.formatTimeAmount(playtimeDay));
|
||||
@ -130,7 +133,9 @@ public class InspectPageParser {
|
||||
addValue("lastSeen", FormatUtils.formatTimeAmount(playTime));
|
||||
|
||||
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()) {
|
||||
addValue("sessionLengthMedian", "No Sessions");
|
||||
addValue("sessionLengthLongest", "No Sessions");
|
||||
@ -163,7 +168,7 @@ public class InspectPageParser {
|
||||
String banned = isBanned ? "Banned" : "";
|
||||
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) {
|
||||
|
@ -11,6 +11,6 @@ public class SessionLengthComparator implements Comparator<Session> {
|
||||
|
||||
@Override
|
||||
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
|
||||
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
|
||||
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(element);
|
||||
if (i < elements.length - 1) {
|
||||
builder.append("<br>");
|
||||
}
|
||||
}
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@ public class ActionsTableCreator {
|
||||
long date = action.getDate();
|
||||
|
||||
html.append(Html.TABLELINE_3_CUSTOMKEY_1.parse(
|
||||
String.valueOf(date), FormatUtils.formatTimeStamp(date),
|
||||
String.valueOf(date), FormatUtils.formatTimeStampYear(date),
|
||||
action.getDoneAction().toString(),
|
||||
action.getAdditionalInfo()
|
||||
));
|
||||
|
@ -35,6 +35,7 @@ public class ComparatorTest {
|
||||
List<Session> test = RandomData.randomSessions();
|
||||
List<Long> longValues = test.stream().map(Session::getSessionStart).collect(Collectors.toList());
|
||||
longValues.sort(Long::compare);
|
||||
Collections.reverse(longValues);
|
||||
test.sort(new SessionStartComparator());
|
||||
List<Long> afterSort = test.stream().map(Session::getSessionStart).collect(Collectors.toList());
|
||||
assertEquals(longValues, afterSort);
|
||||
|
Loading…
Reference in New Issue
Block a user