~changed WeekOverview to use Costumer count instead of Artikel count
This commit is contained in:
parent
cf7500f472
commit
e6d56675d3
|
@ -48,18 +48,13 @@ public class WeekOverview implements Analysis<Map<String, Map.Entry<Double, Inte
|
||||||
String day = instance.stringValue(dayIndex);
|
String day = instance.stringValue(dayIndex);
|
||||||
|
|
||||||
|
|
||||||
int count = 0;
|
|
||||||
for (int j = startArticles; j < endArticles; j++) {
|
|
||||||
count += (int) instance.value(j);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!result.containsKey(day)) {
|
if (!result.containsKey(day)) {
|
||||||
result.put(day, new AbstractMap.SimpleEntry<>(0.0, 0));
|
result.put(day, new AbstractMap.SimpleEntry<>(0.0, 0));
|
||||||
}
|
}
|
||||||
result.put(day,
|
result.put(day,
|
||||||
new AbstractMap.SimpleEntry<>(
|
new AbstractMap.SimpleEntry<>(
|
||||||
result.get(day).getKey() + amount,
|
result.get(day).getKey() + amount,
|
||||||
result.get(day).getValue() + count
|
result.get(day).getValue() + 1
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,8 +30,7 @@ class WeekOverviewTest {
|
||||||
|
|
||||||
AtomicReference<Map<String, Map.Entry<Double, Integer>>> result = new AtomicReference<>();
|
AtomicReference<Map<String, Map.Entry<Double, Integer>>> result = new AtomicReference<>();
|
||||||
|
|
||||||
assertTimeout(Duration.ofMillis(1), () -> result.set(overview.getResult()));
|
assertTimeout(Duration.ofMillis(2), () -> result.set(overview.getResult()));
|
||||||
|
|
||||||
|
|
||||||
assertEquals(2477, result.get().get("Montag").getKey());
|
assertEquals(2477, result.get().get("Montag").getKey());
|
||||||
assertEquals(3359, result.get().get("Dienstag").getKey());
|
assertEquals(3359, result.get().get("Dienstag").getKey());
|
||||||
|
|
Loading…
Reference in New Issue