Kaynağa Gözat

Betere logging teams

Harry de Boer 5 yıl önce
ebeveyn
işleme
18503ca8b2

+ 19 - 0
src/main/java/puzzeltocht/domain/Mission.java

@@ -1,5 +1,6 @@
 package puzzeltocht.domain;
 package puzzeltocht.domain;
 
 
+import java.util.Objects;
 import java.util.UUID;
 import java.util.UUID;
 
 
 public class Mission {
 public class Mission {
@@ -54,4 +55,22 @@ public class Mission {
         }
         }
         this.answer = answer;
         this.answer = answer;
     }
     }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) {
+            return true;
+        }
+        if (o == null || getClass() != o.getClass()) {
+            return false;
+        }
+        Mission mission = (Mission) o;
+        return id.equals(mission.id);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(id);
+    }
+
 }
 }

+ 4 - 2
src/main/java/puzzeltocht/service/TeamService.java

@@ -30,7 +30,7 @@ public class TeamService {
         if (update != null) {
         if (update != null) {
             t.setCurrentLocation(update.getLocation());
             t.setCurrentLocation(update.getLocation());
             if (update.getAnswer() != null) {
             if (update.getAnswer() != null) {
-                LOGGER.info("Team {}, {}", t.getName(), update);
+                LOGGER.info("Team {}, {}, antwoord: {}", t.getName(), t.getCurrentLocation(), update.getAnswer());
             }
             }
         }
         }
 
 
@@ -38,8 +38,10 @@ public class TeamService {
 
 
         if (m == null || missionService.evaluate(m, update)) {
         if (m == null || missionService.evaluate(m, update)) {
             m = event.nextMission(m);
             m = event.nextMission(m);
+            if (!m.equals(t.getCurrentMission())) {
+                LOGGER.info("Team {}, {}, missie: {}", t.getName(), t.getCurrentLocation(), m.getTitle());
+            }
             t.setCurrentMission(m);
             t.setCurrentMission(m);
-            LOGGER.info("{} {}", t.getName(), m.getTitle());
         }
         }
 
 
         return t.getCurrentMission();
         return t.getCurrentMission();