From e6d56675d32eea40c4a6e44fb3504b6ce6ae186a Mon Sep 17 00:00:00 2001 From: Julian Hinxlage Date: Thu, 16 May 2019 14:56:02 +0200 Subject: [PATCH 1/3] ~changed WeekOverview to use Costumer count instead of Artikel count --- .../java/de/hsel/spm/baudas/analysis/WeekOverview.java | 7 +------ .../java/de/hsel/spm/baudas/analysis/WeekOverviewTest.java | 3 +-- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/main/java/de/hsel/spm/baudas/analysis/WeekOverview.java b/src/main/java/de/hsel/spm/baudas/analysis/WeekOverview.java index 7c54043..58f1443 100644 --- a/src/main/java/de/hsel/spm/baudas/analysis/WeekOverview.java +++ b/src/main/java/de/hsel/spm/baudas/analysis/WeekOverview.java @@ -48,18 +48,13 @@ public class WeekOverview implements Analysis(0.0, 0)); } result.put(day, new AbstractMap.SimpleEntry<>( result.get(day).getKey() + amount, - result.get(day).getValue() + count + result.get(day).getValue() + 1 ) ); } diff --git a/src/test/java/de/hsel/spm/baudas/analysis/WeekOverviewTest.java b/src/test/java/de/hsel/spm/baudas/analysis/WeekOverviewTest.java index 0f6f283..be3ea77 100644 --- a/src/test/java/de/hsel/spm/baudas/analysis/WeekOverviewTest.java +++ b/src/test/java/de/hsel/spm/baudas/analysis/WeekOverviewTest.java @@ -30,8 +30,7 @@ class WeekOverviewTest { AtomicReference>> 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(3359, result.get().get("Dienstag").getKey()); From ad0e2040ee41277f686a1197ea9e4d5b33089623 Mon Sep 17 00:00:00 2001 From: joethei Date: Thu, 16 May 2019 15:24:39 +0200 Subject: [PATCH 2/3] ~ testing correct stuff again #SPM-14: add work #20m testing --- .../spm/baudas/analysis/WeekOverviewTest.java | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/test/java/de/hsel/spm/baudas/analysis/WeekOverviewTest.java b/src/test/java/de/hsel/spm/baudas/analysis/WeekOverviewTest.java index be3ea77..71907eb 100644 --- a/src/test/java/de/hsel/spm/baudas/analysis/WeekOverviewTest.java +++ b/src/test/java/de/hsel/spm/baudas/analysis/WeekOverviewTest.java @@ -30,7 +30,7 @@ class WeekOverviewTest { AtomicReference>> result = new AtomicReference<>(); - assertTimeout(Duration.ofMillis(2), () -> result.set(overview.getResult())); + assertTimeout(Duration.ofMillis(15), () -> result.set(overview.getResult())); assertEquals(2477, result.get().get("Montag").getKey()); assertEquals(3359, result.get().get("Dienstag").getKey()); @@ -39,12 +39,12 @@ class WeekOverviewTest { assertEquals(2399, result.get().get("Freitag").getKey()); assertEquals(18273, result.get().get("Samstag").getKey()); - assertEquals(3216, result.get().get("Montag").getValue()); - assertEquals(5503, result.get().get("Dienstag").getValue()); - assertEquals(1888, result.get().get("Mittwoch").getValue()); - assertEquals(3568, result.get().get("Donnerstag").getValue()); - assertEquals(2953, result.get().get("Freitag").getValue()); - assertEquals(26243, result.get().get("Samstag").getValue()); + assertEquals(8, result.get().get("Montag").getValue()); + assertEquals(13, result.get().get("Dienstag").getValue()); + assertEquals(5, result.get().get("Mittwoch").getValue()); + assertEquals(9, result.get().get("Donnerstag").getValue()); + assertEquals(10, result.get().get("Freitag").getValue()); + assertEquals(55, result.get().get("Samstag").getValue()); } @Test @@ -56,7 +56,7 @@ class WeekOverviewTest { AtomicReference>> result = new AtomicReference<>(); - assertTimeout(Duration.ofMillis(3), () -> result.set(overview.getResult())); + assertTimeout(Duration.ofMillis(15), () -> result.set(overview.getResult())); assertEquals(26273, result.get().get("Montag").getKey()); @@ -66,12 +66,12 @@ class WeekOverviewTest { assertEquals(26413, result.get().get("Freitag").getKey()); assertEquals(146279, result.get().get("Samstag").getKey()); - assertEquals(39839, result.get().get("Montag").getValue()); - assertEquals(34992, result.get().get("Dienstag").getValue()); - assertEquals(37299, result.get().get("Mittwoch").getValue()); - assertEquals(35005, result.get().get("Donnerstag").getValue()); - assertEquals(38911, result.get().get("Freitag").getValue()); - assertEquals(214051, result.get().get("Samstag").getValue()); + assertEquals(108, result.get().get("Montag").getValue()); + assertEquals(93, result.get().get("Dienstag").getValue()); + assertEquals(89, result.get().get("Mittwoch").getValue()); + assertEquals(90, result.get().get("Donnerstag").getValue()); + assertEquals(110, result.get().get("Freitag").getValue()); + assertEquals(510, result.get().get("Samstag").getValue()); } @Test @@ -83,7 +83,7 @@ class WeekOverviewTest { AtomicReference>> result = new AtomicReference<>(); - assertTimeout(Duration.ofMillis(30), () -> result.set(overview.getResult())); + assertTimeout(Duration.ofMillis(50), () -> result.set(overview.getResult())); assertEquals(295688, result.get().get("Montag").getKey()); @@ -93,11 +93,11 @@ class WeekOverviewTest { assertEquals(330907, result.get().get("Freitag").getKey()); assertEquals(1410789, result.get().get("Samstag").getKey()); - assertEquals(426952, result.get().get("Montag").getValue()); - assertEquals(379125, result.get().get("Dienstag").getValue()); - assertEquals(373891, result.get().get("Mittwoch").getValue()); - assertEquals(356996, result.get().get("Donnerstag").getValue()); - assertEquals(480062, result.get().get("Freitag").getValue()); - assertEquals(2015766, result.get().get("Samstag").getValue()); + assertEquals(1058, result.get().get("Montag").getValue()); + assertEquals(942, result.get().get("Dienstag").getValue()); + assertEquals(915, result.get().get("Mittwoch").getValue()); + assertEquals(919, result.get().get("Donnerstag").getValue()); + assertEquals(1177, result.get().get("Freitag").getValue()); + assertEquals(4989, result.get().get("Samstag").getValue()); } } From 41ae0c46e7260f6d7f5031ca974f1aeb88c548ef Mon Sep 17 00:00:00 2001 From: joethei Date: Thu, 16 May 2019 15:45:58 +0200 Subject: [PATCH 3/3] ~ removed unusable variables --- .../java/de/hsel/spm/baudas/analysis/WeekOverview.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/main/java/de/hsel/spm/baudas/analysis/WeekOverview.java b/src/main/java/de/hsel/spm/baudas/analysis/WeekOverview.java index 58f1443..acb1f8d 100644 --- a/src/main/java/de/hsel/spm/baudas/analysis/WeekOverview.java +++ b/src/main/java/de/hsel/spm/baudas/analysis/WeekOverview.java @@ -36,16 +36,11 @@ public class WeekOverview implements Analysis(); - int dayIndex = Attribute.SHOPPING_DAY; - int amountIndex = Attribute.PURCHASE_AMOUNT; - - int startArticles = Attribute.POWER_TOOLS; - int endArticles = Attribute.GARDENING_TOOLS + 1; for (int i = 0; i < instances.numInstances(); i++) { Instance instance = instances.get(i); - double amount = instance.value(amountIndex); - String day = instance.stringValue(dayIndex); + double amount = instance.value(Attribute.PURCHASE_AMOUNT); + String day = instance.stringValue(Attribute.SHOPPING_DAY); if (!result.containsKey(day)) {