mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-03-07 17:28:03 +08:00
Fixes to Regression bugs #630:
- Removed PlaceholderReplacer debug logs - Removed unregistered players from playerbase stack graph - Made a couple optimizations to ActivityData calculation
This commit is contained in:
parent
b25acb18c4
commit
228997950a
@ -103,21 +103,22 @@ public class PlayersMutator {
|
||||
|
||||
public TreeMap<Long, Map<String, Set<UUID>>> toActivityDataMap(long date) {
|
||||
TreeMap<Long, Map<String, Set<UUID>>> activityData = new TreeMap<>();
|
||||
if (!players.isEmpty()) {
|
||||
for (PlayerContainer player : players) {
|
||||
for (long time = date; time >= date - TimeAmount.MONTH.ms() * 2L; time -= TimeAmount.WEEK.ms()) {
|
||||
for (long time = date; time >= date - TimeAmount.MONTH.ms() * 2L; time -= TimeAmount.WEEK.ms()) {
|
||||
Map<String, Set<UUID>> map = activityData.getOrDefault(time, new HashMap<>());
|
||||
if (!players.isEmpty()) {
|
||||
for (PlayerContainer player : players) {
|
||||
if (player.getValue(PlayerKeys.REGISTERED).orElse(0L) < time) {
|
||||
continue;
|
||||
}
|
||||
ActivityIndex activityIndex = player.getActivityIndex(time);
|
||||
String activityGroup = activityIndex.getGroup();
|
||||
|
||||
Map<String, Set<UUID>> map = activityData.getOrDefault(time, new HashMap<>());
|
||||
Set<UUID> uuids = map.getOrDefault(activityGroup, new HashSet<>());
|
||||
uuids.add(player.getUnsafe(PlayerKeys.UUID));
|
||||
map.put(activityGroup, uuids);
|
||||
activityData.put(time, map);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
activityData.put(date, Collections.emptyMap());
|
||||
activityData.put(time, map);
|
||||
}
|
||||
return activityData;
|
||||
}
|
||||
|
@ -36,11 +36,7 @@ public class PlaceholderReplacer extends HashMap<String, Serializable> implement
|
||||
if (!container.supports(key)) {
|
||||
return;
|
||||
}
|
||||
long ns = System.nanoTime();
|
||||
Log.debug(key.getPlaceholder());
|
||||
put(key.getPlaceholder(), formatter.apply(container.getSupplier(key).get()));
|
||||
ns = System.nanoTime() - ns;
|
||||
Log.debug(key.getPlaceholder() + ": " + Formatters.benchmark().apply(ns));
|
||||
}
|
||||
|
||||
public <T> void addAllPlaceholdersFrom(DataContainer container, Formatter<T> formatter, PlaceholderKey<T>... keys) {
|
||||
|
Loading…
Reference in New Issue
Block a user