Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

-> Added initiator statistics

Signed-off-by: Florian Hagenauer <hagenauer.florian@gmail.com>
  • Loading branch information...
commit c11349c002f69c46f32c9a24c61c28a6e81e7bad 1 parent fb348f7
@floxyz authored
Showing with 22 additions and 0 deletions.
  1. +22 −0 Customer Journeys.analyzer/src/logic/DetailAnalyzer.java
View
22 Customer Journeys.analyzer/src/logic/DetailAnalyzer.java
@@ -4,6 +4,7 @@
import journeymodel.EChannel;
import journeymodel.EEvaluation;
+import journeymodel.EInitiator;
import journeymodel.Journey;
import journeymodel.JourneySet;
import journeymodel.Touchpoint;
@@ -48,6 +49,7 @@ private String generateJourneyStatistics(Journey journey) {
builder.append("####################\nDetail Statistics for journey " + journey.getName() + " (" + journey.getID() + ")\n");
builder.append(this.getRatingStatistics(journey));
builder.append(this.getChannelStatistics(journey));
+ builder.append(this.getInitiatorStatistics(journey));
return builder.append("####################\n\n").toString();
}
@@ -100,4 +102,24 @@ private String getSingleChannelStatistic(Journey journey, EChannel channel) {
}
return (channel.toString() + ": " + channelCount + " (" + ((float) channelCount / (float) journey.getTouchpoints().size()) + "%)\n");
}
+
+ private String getInitiatorStatistics(Journey journey) {
+ List<EInitiator> initiatorList = EInitiator.VALUES;
+ StringBuilder builder = new StringBuilder("----------\nInitiator Statistics for " + initiatorList.size() + " initiators:\n");
+
+ for (EInitiator initiator : initiatorList) {
+ builder.append(this.getSingleInitiatorStatistic(journey, initiator));
+ }
+ return builder.toString();
+ }
+
+ private String getSingleInitiatorStatistic(Journey journey, EInitiator initiator) {
+ Integer initiatorCount = 0;
+ for (Touchpoint touchpoint : journey.getTouchpoints()) {
+ if (touchpoint.getInitiator() == initiator) {
+ initiatorCount++;
+ }
+ }
+ return (initiator.toString() + ": " + initiatorCount + " (" + ((float) initiatorCount / (float) journey.getTouchpoints().size()) + "%)\n");
+ }
}
Please sign in to comment.
Something went wrong with that request. Please try again.