Skip to content
Snippets Groups Projects
Commit e9d1e3f6 authored by Tor-Einar Skog's avatar Tor-Einar Skog
Browse files

Bugfix: Avoiding double entries of weather stations when user has one or

more private weather stations
parent 3403e0ac
No related branches found
No related tags found
2 merge requests!22Develop,!21Privat varsel
......@@ -33,6 +33,7 @@ import java.util.List;
import java.util.Objects;
import java.util.ResourceBundle;
import java.util.Set;
import java.util.stream.Collectors;
import javax.ejb.LocalBean;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
......@@ -410,8 +411,14 @@ public class PointOfInterestBean {
}
}
catch(NoResultException ex) {}
// Getting all weather stations for user's organization
retVal.addAll(this.getWeatherstationsForOrganization(user.getOrganizationId(), Boolean.TRUE));
// Getting all weather stations for user's organization. Need to avoid
// double catching of privately owned weather station
retVal.addAll(this.getWeatherstationsForOrganization(user.getOrganizationId(), Boolean.TRUE)
.stream()
.filter(weatherStation -> ! weatherStation.getUserId().getUserId().equals(user.getUserId()))
.collect(Collectors.toList())
);
}
Collections.sort(retVal);
return retVal;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment