2 Commits 18503ca8b2 ... 3d86c42713

Autore SHA1 Messaggio Data
  Harry de Boer 3d86c42713 Toon elkel markers voor actieve teams 5 anni fa
  Harry de Boer 2f0fe592fc Maak team updates synchronized 5 anni fa

+ 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;
     }

+ 3 - 3
src/main/java/puzzeltocht/domain/Event.java

@@ -28,15 +28,15 @@ public class Event {
         return description;
     }
 
-    public void addTeam(Team t) {
+    public synchronized void addTeam(Team t) {
         teams.put(t.getId(), t);
     }
 
-    public Collection<Team> getTeams() {
+    public synchronized Collection<Team> getTeams() {
         return Collections.unmodifiableCollection(teams.values());
     }
 
-    public Team getTeam(UUID id) {
+    public synchronized Team getTeam(UUID id) {
         return teams.get(id);
     }
 

+ 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);