Billing: Add functionality to collapse curves

This commit is contained in:
2024-01-22 23:05:54 +01:00
parent 3642c5ac07
commit 05909919e2
6 changed files with 314 additions and 36 deletions

View File

@ -18,10 +18,11 @@ namespace Elwig.Helpers.Billing {
public double? GebundenFlatBonus {
get {
try {
return GebundenGraph?.DataX.Zip(GebundenGraph.DataY)
var val = GebundenGraph?.DataX.Zip(GebundenGraph.DataY)
.Select(e => Math.Round(e.Second - DataGraph.GetPriceAtOe(e.First), Precision))
.Distinct()
.Single();
return (val == 0) ? null : val;
} catch {
return null;
}