[#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

@ -284,26 +284,27 @@ namespace Elwig.Helpers.Billing {
}
}
}
var attributes = data
.Select(e => e.Key)
.Where(k => k.Length > 3 && k.Contains('/'))
.Where(k => !k.StartsWith('/') && k.Contains('/'))
.Select(k => k.Split('/')[1])
.Distinct()
.ToList();
foreach (var idx in attributes) {
var len = vaributes.Count(e => e.AttrId == idx);
foreach (var (v, ks) in rev1) {
var myKs = ks.Where(k => k.EndsWith(idx)).ToList();
var myKs = ks.Where(k => k.EndsWith($"/{idx}")).ToList();
if (myKs.Count > 1 && ((myKs.Count >= len * 0.5 && useDefault) || myKs.Count == len)) {
foreach (var k in myKs) data.Remove(k);
data[$"/{idx}"] = v;
data[(idx.StartsWith('-') ? "" : "/") + idx] = v;
}
}
foreach (var (v, ks) in rev2) {
var myKs = ks.Where(k => k.EndsWith(idx)).ToList();
var myKs = ks.Where(k => k.EndsWith($"/{idx}")).ToList();
if (myKs.Count > 1 && ((myKs.Count >= len * 0.5 && useDefault) || myKs.Count == len)) {
foreach (var k in myKs) data.Remove(k);
data[$"/{idx}"] = v;
data[(idx.StartsWith('-') ? "" : "/") + idx] = v;
}
}
}
@ -333,10 +334,12 @@ namespace Elwig.Helpers.Billing {
continue;
}
foreach (var c in entry.Vaributes) {
var v = new RawVaribute(c.Variety!.SortId, c.Attribute?.AttrId ?? "", c.Cultivation?.CultId);
if (v.CultId == "") v.CultId = null;
if (entry.Abgewertet) {;
qualityWei[c.ToString()] = node.DeepClone();
qualityWei[v.ToString()] = node.DeepClone();
} else {
payment[c.ToString()] = node.DeepClone();
payment[v.ToString()] = node.DeepClone();
}
}
}