[#34] Third step of not using Bio as Attribute

This commit is contained in:
2024-02-20 21:16:06 +01:00
parent f8ee478a9e
commit 56fdf62c5c
7 changed files with 215 additions and 77 deletions

View File

@ -45,8 +45,8 @@ namespace Elwig.Helpers.Billing {
return dict;
}
public decimal CalculatePrice(string sortid, string? attrid, string qualid, bool gebunden, double oe, double kmw) {
var curve = GetQualityCurve(qualid, sortid, attrid) ?? GetCurve(sortid, attrid);
public decimal CalculatePrice(string sortid, string? attrid, string? cultid, string qualid, bool gebunden, double oe, double kmw) {
var curve = GetQualityCurve(qualid, sortid, attrid, cultid) ?? GetCurve(sortid, attrid, cultid);
return GetCurveValueAt((gebunden ? curve.Gebunden : null) ?? curve.Normal, curve.Mode == CurveMode.Oe ? oe : kmw);
}
@ -60,12 +60,12 @@ namespace Elwig.Helpers.Billing {
throw new InvalidOperationException();
}
protected Curve GetCurve(string sortid, string? attrid) {
return PaymentData[new(sortid, attrid ?? "", null)];
protected Curve GetCurve(string sortid, string? attrid, string? cultid) {
return PaymentData[new(sortid, attrid ?? "", cultid ?? "")];
}
protected Curve? GetQualityCurve(string qualid, string sortid, string? attrid) {
return QualityData.TryGetValue(new(qualid, sortid, attrid ?? "", null), out var curve) ? curve : null;
protected Curve? GetQualityCurve(string qualid, string sortid, string? attrid, string? cultid) {
return QualityData.TryGetValue(new(qualid, sortid, attrid ?? "", cultid ?? ""), out var curve) ? curve : null;
}
}
}