use sail number instead of name as stable sorting for CompetitorWithBoat

This commit is contained in:
Axel Uhl
2024-03-06 10:16:57 +01:00
parent 9e6a90b49b
commit 9726db9a9c
4 changed files with 19 additions and 1 deletions
@@ -97,4 +97,14 @@ public interface Competitor extends NamedWithID, IsManagedByCache<SharedDomainFa
*/
Duration getTimeOnDistanceAllowancePerNauticalMile();
/**
* When two competitors score the same in a leaderboard and the tie cannot be broken, in order to avoid oscillations
* when users roam across different replicas, a stable ordering criterion is still required. This may be the name
* or the sail number (in case this is a competitor with boat).<p>
*
* This default implementation uses the {@link #getName() name}.
*/
default String getStableLastResortOrderingCriterion() {
return getName();
}
}
@@ -6,4 +6,8 @@ package com.sap.sailing.domain.base;
* @author fmittag
*/
public interface CompetitorWithBoat extends Competitor, WithBoat {
@Override
default String getStableLastResortOrderingCriterion() {
return getBoat().getSailID();
}
}