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
// updates that led to this change are replicated separately
scheduler.execute(()->
// Notify interested users:
notificationService.notifyUserOnBoatClassRaceChangesStateToFinished(trackedRace.getRace().getBoatClass(), trackedRace,
getMostAppropriateLeaderboard(), getMostAppropriateRaceColumn(), getMostAppropriateFleet()));
if(newFinishedTime.after(MillisecondsTimePoint.now().minus(Duration.ONE_HOUR))) {
scheduler.execute(()->
// Notify interested users:
notificationService.notifyUserOnBoatClassRaceChangesStateToFinished(trackedRace.getRace().getBoatClass(), trackedRace,
getMostAppropriateLeaderboard(), getMostAppropriateRaceColumn(), getMostAppropriateFleet()));
}
}
@Override
@@ -1838,7 +1840,8 @@ public class RacingEventServiceImpl implements RacingEventService, ClearStateTes
replicate(new UpdateMarkPassings(getRaceIdentifier(), competitor, markPassings));
final MarkPassing last = Util.last(markPassings);
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(() ->
// Notify interested users:
notificationService.notifyUserOnCompetitorPassesFinish(competitor, trackedRace,