Jelajahi Sumber

Toon elkel markers voor actieve teams

Harry de Boer 5 tahun lalu
induk
melakukan
3d86c42713

+ 16 - 1
src/main/java/puzzeltocht/controller/dto/TeamDto.java

@@ -1,16 +1,23 @@
 package puzzeltocht.controller.dto;
 
+import puzzeltocht.domain.Mission;
+import puzzeltocht.domain.MissionType;
 import puzzeltocht.domain.Team;
 
 public class TeamDto {
     private final String name;
     private final String mission;
+    private final boolean started;
+    private final boolean finished;
     private final LocationDto location;
 
     public TeamDto(Team t) {
         this.name = t.getName();
         this.location = t.getCurrentLocation() == null ? null : new LocationDto(t.getCurrentLocation());
-        this.mission = t.getCurrentMission() == null ? null : t.getCurrentMission().getTitle();
+        Mission m = t.getCurrentMission();
+        this.mission = m == null ? null : m.getTitle();
+        this.started = m != null && m.getType() != MissionType.START;
+        this.finished = m != null && m.getType() == MissionType.FINISH;
     }
 
     public String getName() {
@@ -21,6 +28,14 @@ public class TeamDto {
         return mission;
     }
 
+    public boolean isStarted() {
+        return started;
+    }
+
+    public boolean isFinished() {
+        return finished;
+    }
+
     public LocationDto getLocation() {
         return location;
     }

+ 1 - 1
src/main/resources/static/dashboard/dashboard.js

@@ -59,7 +59,7 @@ class Dashboard {
         this.markers.forEach(m => m.remove());
         this.markers = [];
         teams.forEach(t => {
-            if (t.location !== null) {
+            if (t.location !== null && t.finished !== false && t.started === true) {
                 let marker = L.marker([t.location.latitude, t.location.longitude]).addTo(this.map);
                 marker.bindPopup(t.name).openPopup();
                 this.markers.push(marker);