mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-01 05:57:50 +01:00
Adds more visibility to the code
This commit is contained in:
parent
36574ec4e2
commit
f7941fd59f
@ -162,18 +162,19 @@ public class AnalysisUtils {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static String getBooleanPercentage(AnalysisType analysisType, PluginData source, List<UUID> uuids) {
|
public static String getBooleanPercentage(AnalysisType analysisType, PluginData source, List<UUID> uuids) {
|
||||||
if (analysisType == AnalysisType.BOOLEAN_PERCENTAGE) {
|
if (analysisType != AnalysisType.BOOLEAN_PERCENTAGE) {
|
||||||
try {
|
return source.parseContainer("Err ", "Wrong Analysistype specified: " + analysisType.name());
|
||||||
List<Boolean> tempList = getCorrectValues(uuids, source)
|
}
|
||||||
.map(value -> (boolean) value)
|
|
||||||
.collect(Collectors.toList());
|
try {
|
||||||
long count = tempList.stream().filter(value -> value).count();
|
List<Boolean> tempList = getCorrectValues(uuids, source)
|
||||||
return source.parseContainer(analysisType.getModifier(), (((double) count / tempList.size()) * 100) + "%");
|
.map(value -> (boolean) value)
|
||||||
} catch (Exception | NoClassDefFoundError | NoSuchFieldError e) {
|
.collect(Collectors.toList());
|
||||||
return logPluginDataCausedError(source, e);
|
long count = tempList.stream().filter(value -> value).count();
|
||||||
}
|
return source.parseContainer(analysisType.getModifier(), (((double) count / tempList.size()) * 100) + "%");
|
||||||
|
} catch (Exception | NoClassDefFoundError | NoSuchFieldError e) {
|
||||||
|
return logPluginDataCausedError(source, e);
|
||||||
}
|
}
|
||||||
return source.parseContainer("Err ", "Wrong Analysistype specified: " + analysisType.name());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -183,18 +184,19 @@ public class AnalysisUtils {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
public static String getBooleanTotal(AnalysisType analysisType, PluginData source, List<UUID> uuids) {
|
public static String getBooleanTotal(AnalysisType analysisType, PluginData source, List<UUID> uuids) {
|
||||||
if (analysisType == AnalysisType.BOOLEAN_TOTAL) {
|
if (analysisType != AnalysisType.BOOLEAN_TOTAL) {
|
||||||
try {
|
return source.parseContainer("Err ", "Wrong Analysistype specified: " + analysisType.name());
|
||||||
List<Boolean> tempList = getCorrectValues(uuids, source)
|
}
|
||||||
.map(value -> (boolean) value)
|
|
||||||
.collect(Collectors.toList());
|
try {
|
||||||
long count = tempList.stream().filter(value -> value).count();
|
List<Boolean> tempList = getCorrectValues(uuids, source)
|
||||||
return source.parseContainer(analysisType.getModifier(), count + " / " + tempList.size());
|
.map(value -> (boolean) value)
|
||||||
} catch (Exception e) {
|
.collect(Collectors.toList());
|
||||||
return logPluginDataCausedError(source, e);
|
long count = tempList.stream().filter(value -> value).count();
|
||||||
}
|
return source.parseContainer(analysisType.getModifier(), count + " / " + tempList.size());
|
||||||
|
} catch (Exception e) {
|
||||||
|
return logPluginDataCausedError(source, e);
|
||||||
}
|
}
|
||||||
return source.parseContainer("Err ", "Wrong Analysistype specified: " + analysisType.name());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String logPluginDataCausedError(PluginData source, Throwable e) {
|
private static String logPluginDataCausedError(PluginData source, Throwable e) {
|
||||||
@ -214,6 +216,7 @@ public class AnalysisUtils {
|
|||||||
public static int getUniqueJoins(Map<UUID, List<SessionData>> sessions, long scale) {
|
public static int getUniqueJoins(Map<UUID, List<SessionData>> sessions, long scale) {
|
||||||
long now = MiscUtils.getTime();
|
long now = MiscUtils.getTime();
|
||||||
long nowMinusScale = now - scale;
|
long nowMinusScale = now - scale;
|
||||||
|
|
||||||
Set<UUID> uniqueJoins = new HashSet<>();
|
Set<UUID> uniqueJoins = new HashSet<>();
|
||||||
sessions.forEach((uuid, s) ->
|
sessions.forEach((uuid, s) ->
|
||||||
s.stream()
|
s.stream()
|
||||||
@ -221,6 +224,7 @@ public class AnalysisUtils {
|
|||||||
.map(session -> uuid)
|
.map(session -> uuid)
|
||||||
.forEach(uniqueJoins::add)
|
.forEach(uniqueJoins::add)
|
||||||
);
|
);
|
||||||
|
|
||||||
return uniqueJoins.size();
|
return uniqueJoins.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user