mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-09-21 21:25:38 +00:00
bug5932: return null for distance/duration ratios with zero denominator
This commit is contained in:
+4
-1
@@ -58,7 +58,10 @@ public abstract class TackTypeRatioCollector<ADDABLE> implements Collector<HasTa
|
||||
|
||||
@Override
|
||||
public Function<Map<TackType, ADDABLE>, Double> finisher() {
|
||||
return sumPerTackType->divide(sumPerTackType.get(TackType.LONGTACK), sumPerTackType.get(TackType.SHORTTACK));
|
||||
return sumPerTackType->{
|
||||
final ADDABLE shortTackSum = sumPerTackType.get(TackType.SHORTTACK);
|
||||
return shortTackSum.equals(nullValue) ? null : divide(sumPerTackType.get(TackType.LONGTACK), shortTackSum);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user