mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-02-05 23:11:56 +01:00
Fixed Activity Pie amounts
Fixed Graph size issue on load
This commit is contained in:
parent
64cac023f7
commit
ce151a612c
@ -51,7 +51,7 @@ public class AnalysisData extends RawData {
|
|||||||
playtimePart = new PlaytimePart();
|
playtimePart = new PlaytimePart();
|
||||||
killPart = new KillPart(joinInfoPart);
|
killPart = new KillPart(joinInfoPart);
|
||||||
tpsPart = new TPSPart();
|
tpsPart = new TPSPart();
|
||||||
activityPart = new ActivityPart(joinInfoPart, tpsPart);
|
activityPart = new ActivityPart(playerCountPart, joinInfoPart, tpsPart);
|
||||||
worldPart = new WorldPart();
|
worldPart = new WorldPart();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,13 +34,13 @@ import java.util.stream.Collectors;
|
|||||||
* ${punchCardSeries} - Data for HighCharts
|
* ${punchCardSeries} - Data for HighCharts
|
||||||
* <p>
|
* <p>
|
||||||
* ${sessionAverage} - Formatted Time amount
|
* ${sessionAverage} - Formatted Time amount
|
||||||
* //TODO ${tableBodyRecentLogins}
|
|
||||||
*
|
*
|
||||||
* @author Rsl1122
|
* @author Rsl1122
|
||||||
* @since 3.5.2
|
* @since 3.5.2
|
||||||
*/
|
*/
|
||||||
public class ActivityPart extends RawData {
|
public class ActivityPart extends RawData {
|
||||||
|
|
||||||
|
private final PlayerCountPart playerCount;
|
||||||
private final JoinInfoPart joins;
|
private final JoinInfoPart joins;
|
||||||
private final TPSPart tpsPart;
|
private final TPSPart tpsPart;
|
||||||
private final Set<UUID> bans;
|
private final Set<UUID> bans;
|
||||||
@ -50,7 +50,8 @@ public class ActivityPart extends RawData {
|
|||||||
private List<String> recentPlayers;
|
private List<String> recentPlayers;
|
||||||
private List<UUID> recentPlayersUUIDs;
|
private List<UUID> recentPlayersUUIDs;
|
||||||
|
|
||||||
public ActivityPart(JoinInfoPart joins, TPSPart tps) {
|
public ActivityPart(PlayerCountPart playerCount, JoinInfoPart joins, TPSPart tps) {
|
||||||
|
this.playerCount = playerCount;
|
||||||
this.joins = joins;
|
this.joins = joins;
|
||||||
tpsPart = tps;
|
tpsPart = tps;
|
||||||
bans = new HashSet<>();
|
bans = new HashSet<>();
|
||||||
@ -64,9 +65,6 @@ public class ActivityPart extends RawData {
|
|||||||
Verify.nullCheck(recentPlayers);
|
Verify.nullCheck(recentPlayers);
|
||||||
Verify.nullCheck(recentPlayersUUIDs);
|
Verify.nullCheck(recentPlayersUUIDs);
|
||||||
|
|
||||||
// TODO Recent logins table
|
|
||||||
addValue("recentlogins", "");
|
|
||||||
|
|
||||||
activityPiechart();
|
activityPiechart();
|
||||||
|
|
||||||
playerActivityGraphs();
|
playerActivityGraphs();
|
||||||
@ -90,15 +88,14 @@ public class ActivityPart extends RawData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void activityPiechart() {
|
private void activityPiechart() {
|
||||||
|
calculateActivityAmounts();
|
||||||
|
|
||||||
int[] counts = new int[]{active.size(), inactive.size(), joinedOnce.size(), bans.size()};
|
int[] counts = new int[]{active.size(), inactive.size(), joinedOnce.size(), bans.size()};
|
||||||
|
|
||||||
String activityColors = HtmlUtils.separateWithQuotes(
|
String activityColors = HtmlUtils.separateWithQuotes(
|
||||||
"#55ffff", "#ff55ff", "#ff5555", "#ffff55" //TODO Write Colors (enums) for Activity pie.
|
"#55ffff", "#ff55ff", "#ff5555", "#ffff55" //TODO Write Colors (enums) for Activity pie.
|
||||||
);
|
);
|
||||||
addValue("activityColors", activityColors);
|
addValue("activityColors", activityColors);
|
||||||
|
|
||||||
calculateActivityAmounts();
|
|
||||||
|
|
||||||
addValue("playersActive", counts[0]);
|
addValue("playersActive", counts[0]);
|
||||||
addValue("active", counts[0]);
|
addValue("active", counts[0]);
|
||||||
addValue("inactive", counts[1]);
|
addValue("inactive", counts[1]);
|
||||||
@ -107,12 +104,12 @@ public class ActivityPart extends RawData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void calculateActivityAmounts() {
|
private void calculateActivityAmounts() {
|
||||||
for (Map.Entry<UUID, List<Session>> entry : joins.getSessions().entrySet()) {
|
Map<UUID, List<Session>> allSessions = joins.getSessions();
|
||||||
UUID uuid = entry.getKey();
|
for (UUID uuid : playerCount.getUuids()) {
|
||||||
if (bans.contains(uuid)) {
|
if (bans.contains(uuid)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
List<Session> sessions = entry.getValue();
|
List<Session> sessions = allSessions.getOrDefault(uuid, new ArrayList<>());
|
||||||
long lastSeen = AnalysisUtils.getLastSeen(sessions);
|
long lastSeen = AnalysisUtils.getLastSeen(sessions);
|
||||||
long playtime = AnalysisUtils.getTotalPlaytime(sessions);
|
long playtime = AnalysisUtils.getTotalPlaytime(sessions);
|
||||||
int sessionCount = sessions.size();
|
int sessionCount = sessions.size();
|
||||||
@ -134,23 +131,19 @@ public class ActivityPart extends RawData {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void addBan(UUID uuid) {
|
public void addBan(UUID uuid) {
|
||||||
Verify.nullCheck(uuid);
|
bans.add(Verify.nullCheck(uuid));
|
||||||
bans.add(uuid);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addActive(UUID uuid) {
|
public void addActive(UUID uuid) {
|
||||||
Verify.nullCheck(uuid);
|
active.add(Verify.nullCheck(uuid));
|
||||||
active.add(uuid);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addInActive(UUID uuid) {
|
public void addInActive(UUID uuid) {
|
||||||
Verify.nullCheck(uuid);
|
inactive.add(Verify.nullCheck(uuid));
|
||||||
inactive.add(uuid);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addJoinedOnce(UUID uuid) {
|
public void addJoinedOnce(UUID uuid) {
|
||||||
Verify.nullCheck(uuid);
|
joinedOnce.add(Verify.nullCheck(uuid));
|
||||||
joinedOnce.add(uuid);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<Long, Integer> getPlayersOnline() {
|
public Map<Long, Integer> getPlayersOnline() {
|
||||||
|
@ -31,7 +31,6 @@ import java.util.stream.Collectors;
|
|||||||
* ${playersNewAverageDay} - (Number)
|
* ${playersNewAverageDay} - (Number)
|
||||||
* ${playersNewAverageWeek} - (Number)
|
* ${playersNewAverageWeek} - (Number)
|
||||||
* ${playersNewAverageMonth} - (Number)
|
* ${playersNewAverageMonth} - (Number)
|
||||||
* //TODO ${tableBodySessions}
|
|
||||||
*
|
*
|
||||||
* @author Rsl1122
|
* @author Rsl1122
|
||||||
* @since 3.5.2
|
* @since 3.5.2
|
||||||
|
@ -90,10 +90,6 @@ public class CommandUseTable extends Table {
|
|||||||
while (set.next()) {
|
while (set.next()) {
|
||||||
String cmd = set.getString(columnCommand).toLowerCase();
|
String cmd = set.getString(columnCommand).toLowerCase();
|
||||||
int amountUsed = set.getInt(columnTimesUsed);
|
int amountUsed = set.getInt(columnTimesUsed);
|
||||||
Integer get = commandUse.get(cmd);
|
|
||||||
if (get != null && get > amountUsed) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
commandUse.put(cmd, amountUsed);
|
commandUse.put(cmd, amountUsed);
|
||||||
}
|
}
|
||||||
return commandUse;
|
return commandUse;
|
||||||
|
@ -437,10 +437,10 @@
|
|||||||
selected: true
|
selected: true
|
||||||
}, {
|
}, {
|
||||||
name: 'Single Join',
|
name: 'Single Join',
|
||||||
y: ${joinLeaver}
|
y: ${joinLeaver}
|
||||||
}, {
|
}, {
|
||||||
name: 'Banned',
|
name: 'Banned',
|
||||||
y: ${banned}
|
y: ${banned}
|
||||||
}]
|
}]
|
||||||
};
|
};
|
||||||
var worldSeries = {
|
var worldSeries = {
|
||||||
|
Loading…
Reference in New Issue
Block a user