~changed WeekOverview to use Costumer count instead of Artikel count

This commit is contained in:
Julian Hinxlage 2019-05-16 14:56:02 +02:00
parent cf7500f472
commit e6d56675d3
2 changed files with 2 additions and 8 deletions

View File

@ -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
) )
); );
} }

View File

@ -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());