Don't register competitor when creating mapping and competitor is not registered

This commit is contained in:
Jan Broß committed 2015-11-29 09:15:42 +01:00
1 parent da5fd5cc7d
commit 8b9e31d2a5
1 file changed
+4 -3
@@ -404,11 +404,12 @@ public class LeaderboardsResource extends AbstractSailingServerResource {
return Response.status(Status.BAD_REQUEST).entity("No competitor found for id " + competitorId)
.type(MediaType.TEXT_PLAIN).build();
}
// add registration if necessary
Set<Competitor> registered = (Set<Competitor>) hasRegattaLike.getCompetitorsRegisteredInRegattaLog();
if (!registered.contains(mappedTo)) {
hasRegattaLike.getRegattaLike().getRegattaLog().add(
new RegattaLogRegisterCompetitorEventImpl(now, now, author, UUID.randomUUID(), mappedTo));
logger.warning("Competitor found but not registered on a race of " + leaderboardName);
return Response.status(Status.BAD_REQUEST).entity("Competitor found but not registered on a race of " + leaderboardName)
.type(MediaType.TEXT_PLAIN).build();
}
DeviceIdentifier device = new SmartphoneUUIDIdentifierImpl(UUID.fromString(deviceUuid));
TimePoint from = new MillisecondsTimePoint(fromMillis);