Added conditions to prevent notification mails to be sent for old events

This commit is contained in:
Steffen Schaefer committed 2016-10-05 11:05:13 +02:00
1 parent bbe292ebdb
commit b0b01401fb
1 file changed
+8 -5
@@ -1775,10 +1775,12 @@ public class RacingEventServiceImpl implements RacingEventService, ClearStateTes
// no action required; the update signaled by this call is implicit; the race log // no action required; the update signaled by this call is implicit; the race log
// updates that led to this change are replicated separately // updates that led to this change are replicated separately
scheduler.execute(()-> if(newFinishedTime.after(MillisecondsTimePoint.now().minus(Duration.ONE_HOUR))) {
// Notify interested users: scheduler.execute(()->
notificationService.notifyUserOnBoatClassRaceChangesStateToFinished(trackedRace.getRace().getBoatClass(), trackedRace, // Notify interested users:
getMostAppropriateLeaderboard(), getMostAppropriateRaceColumn(), getMostAppropriateFleet())); notificationService.notifyUserOnBoatClassRaceChangesStateToFinished(trackedRace.getRace().getBoatClass(), trackedRace,
getMostAppropriateLeaderboard(), getMostAppropriateRaceColumn(), getMostAppropriateFleet()));
}
} }
@Override @Override
@@ -1838,7 +1840,8 @@ public class RacingEventServiceImpl implements RacingEventService, ClearStateTes
replicate(new UpdateMarkPassings(getRaceIdentifier(), competitor, markPassings)); replicate(new UpdateMarkPassings(getRaceIdentifier(), competitor, markPassings));
final MarkPassing last = Util.last(markPassings); final MarkPassing last = Util.last(markPassings);
if (last != null && last.getWaypoint() == trackedRace.getRace().getCourse().getLastWaypoint() && if (last != null && last.getWaypoint() == trackedRace.getRace().getCourse().getLastWaypoint() &&
trackedRace.getStatus().getStatus() != TrackedRaceStatusEnum.LOADING) { trackedRace.getStatus().getStatus() != TrackedRaceStatusEnum.LOADING &&
last.getTimePoint().after(MillisecondsTimePoint.now().minus(Duration.ONE_HOUR))) {
scheduler.execute(() -> scheduler.execute(() ->
// Notify interested users: // Notify interested users:
notificationService.notifyUserOnCompetitorPassesFinish(competitor, trackedRace, notificationService.notifyUserOnCompetitorPassesFinish(competitor, trackedRace,