mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-12-29 04:27:53 +01:00
Adds more visibility to the code
This commit is contained in:
parent
36574ec4e2
commit
f7941fd59f
@ -162,7 +162,10 @@ 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) {
|
||||||
|
return source.parseContainer("Err ", "Wrong Analysistype specified: " + analysisType.name());
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
List<Boolean> tempList = getCorrectValues(uuids, source)
|
List<Boolean> tempList = getCorrectValues(uuids, source)
|
||||||
.map(value -> (boolean) value)
|
.map(value -> (boolean) value)
|
||||||
@ -173,8 +176,6 @@ public class AnalysisUtils {
|
|||||||
return logPluginDataCausedError(source, e);
|
return logPluginDataCausedError(source, e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return source.parseContainer("Err ", "Wrong Analysistype specified: " + analysisType.name());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param analysisType
|
* @param analysisType
|
||||||
@ -183,7 +184,10 @@ 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) {
|
||||||
|
return source.parseContainer("Err ", "Wrong Analysistype specified: " + analysisType.name());
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
List<Boolean> tempList = getCorrectValues(uuids, source)
|
List<Boolean> tempList = getCorrectValues(uuids, source)
|
||||||
.map(value -> (boolean) value)
|
.map(value -> (boolean) value)
|
||||||
@ -194,8 +198,6 @@ public class AnalysisUtils {
|
|||||||
return logPluginDataCausedError(source, 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) {
|
||||||
Log.error("A PluginData-source caused an exception: " + source.getPlaceholder("").replace("%", ""));
|
Log.error("A PluginData-source caused an exception: " + source.getPlaceholder("").replace("%", ""));
|
||||||
@ -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