mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-29 19:41:35 +01:00
Activity Pie Slices.
This commit is contained in:
parent
864f50df62
commit
fab0a0633a
@ -97,7 +97,8 @@ public class ActivityPart extends RawData {
|
||||
);
|
||||
addValue("activityColors", activityColors);
|
||||
|
||||
// addValue("activitydata", Arrays.toString(counts)); // TODO Check if needed
|
||||
calculateActivityAmounts();
|
||||
|
||||
addValue("playersActive", counts[0]);
|
||||
addValue("active", counts[0]);
|
||||
addValue("inactive", counts[1]);
|
||||
@ -105,6 +106,29 @@ public class ActivityPart extends RawData {
|
||||
addValue("banned", counts[3]);
|
||||
}
|
||||
|
||||
private void calculateActivityAmounts() {
|
||||
for (Map.Entry<UUID, List<Session>> entry : joins.getSessions().entrySet()) {
|
||||
UUID uuid = entry.getKey();
|
||||
if (bans.contains(uuid)) {
|
||||
continue;
|
||||
}
|
||||
List<Session> sessions = entry.getValue();
|
||||
long lastSeen = AnalysisUtils.getLastSeen(sessions);
|
||||
long playtime = AnalysisUtils.getTotalPlaytime(sessions);
|
||||
int sessionCount = sessions.size();
|
||||
if (sessionCount <= 1) {
|
||||
addJoinedOnce(uuid);
|
||||
continue;
|
||||
}
|
||||
boolean isActive = AnalysisUtils.isActive(MiscUtils.getTime(), lastSeen, playtime, sessionCount);
|
||||
if (isActive) {
|
||||
addActive(uuid);
|
||||
} else {
|
||||
addInActive(uuid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void addBans(Collection<UUID> uuids) {
|
||||
bans.addAll(uuids);
|
||||
}
|
||||
|
@ -74,6 +74,7 @@ public class InspectPageParser extends PageParser {
|
||||
addValue("kickCount", timesKicked);
|
||||
|
||||
Map<String, Long> playtimeByServer = sessionsTable.getPlaytimeByServer(uuid);
|
||||
// TODO Server preference pie
|
||||
|
||||
List<String> geolocations = db.getIpsTable().getGeolocations(uuid);
|
||||
List<String> nicknames = db.getNicknamesTable().getNicknames(uuid).stream()
|
||||
|
@ -259,6 +259,13 @@ public class Analysis {
|
||||
Log.debug("Analysis", "TPS Data Size: " + tpsData.size());
|
||||
|
||||
List<UserInfo> userInfo = db.getUserInfoTable().getServerUserInfo();
|
||||
|
||||
for (UserInfo user : userInfo) {
|
||||
if (user.isBanned()) {
|
||||
activity.addBan(user.getUuid());
|
||||
}
|
||||
}
|
||||
|
||||
Map<UUID, UserInfo> mappedUserInfo = userInfo.stream().collect(Collectors.toMap(UserInfo::getUuid, Function.identity()));
|
||||
Map<UUID, Long> lastSeen = db.getSessionsTable().getLastSeenForAllPlayers();
|
||||
for (Map.Entry<UUID, Long> entry : lastSeen.entrySet()) {
|
||||
|
Loading…
Reference in New Issue
Block a user