[#34] Second step of not using Bio as Attribute
This commit is contained in:
@ -362,11 +362,11 @@ namespace Elwig.Helpers {
|
||||
return output.OrderByDescending(l => l.Count());
|
||||
}
|
||||
|
||||
public static List<string> GetVaributes(AppDbContext ctx, int year, bool withSlash = false, bool onlyDelivered = true) {
|
||||
var varieties = ctx.WineVarieties.Select(v => v.SortId).ToList();
|
||||
public static List<RawVaribute> GetVaributes(AppDbContext ctx, int year, bool onlyDelivered = true) {
|
||||
var varieties = ctx.WineVarieties.Select(v => new RawVaribute(v.SortId, "", null)).ToList();
|
||||
var delivered = ctx.DeliveryParts
|
||||
.Where(d => d.Year == year)
|
||||
.Select(d => $"{d.SortId}{(withSlash ? "/" : "")}{d.AttrId}")
|
||||
.Select(d => new RawVaribute(d.SortId, d.AttrId ?? "", d.CultId))
|
||||
.Distinct()
|
||||
.ToList();
|
||||
return [.. (onlyDelivered ? delivered : delivered.Union(varieties)).Order()];
|
||||
@ -375,8 +375,9 @@ namespace Elwig.Helpers {
|
||||
public static List<Varibute> GetVaributeList(AppDbContext ctx, int year, bool onlyDelivered = true) {
|
||||
var varieties = ctx.WineVarieties.ToDictionary(v => v.SortId, v => v);
|
||||
var attributes = ctx.WineAttributes.ToDictionary(a => a.AttrId, a => a);
|
||||
return GetVaributes(ctx, year, false, onlyDelivered)
|
||||
.Select(s => new Varibute(varieties[s[..2]], s.Length > 2 ? attributes[s[2..]] : null))
|
||||
var cultivations = ctx.WineCultivations.ToDictionary(c => c.CultId, c => c);
|
||||
return GetVaributes(ctx, year, onlyDelivered)
|
||||
.Select(s => new Varibute(s, varieties, attributes, cultivations))
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user