Elwig: Rename (wine) variant to variety

This commit is contained in:
2024-01-27 11:36:43 +01:00
parent 519e903d1c
commit d3aca196dd
12 changed files with 30 additions and 29 deletions

View File

@ -163,10 +163,10 @@ namespace Elwig.Helpers.Billing {
dict = [];
}
var variants = data.Where(p => !p.Key.StartsWith('/') && p.Key.Length == 2);
var varieties = data.Where(p => !p.Key.StartsWith('/') && p.Key.Length == 2);
var attributes = data.Where(p => p.Key.StartsWith('/'));
var others = data.Where(p => !p.Key.StartsWith('/') && p.Key.Length > 2 && p.Key != "default");
foreach (var (idx, v) in variants) {
foreach (var (idx, v) in varieties) {
var curve = v?.AsValue() ?? throw new InvalidOperationException();
foreach (var i in vaributes.Where(e => e.StartsWith(idx[..^1]))) {
dict[i] = curve;

View File

@ -70,7 +70,11 @@ namespace Elwig.Helpers.Billing {
return (curves, dict3);
}
private static List<GraphEntry> CreateGraphEntries(AppDbContext ctx, int precision, Dictionary<int, Curve> curves, Dictionary<int, List<string>> entries) {
private static List<GraphEntry> CreateGraphEntries(
AppDbContext ctx, int precision,
Dictionary<int, Curve> curves,
Dictionary<int, List<string>> entries
) {
var vars = ctx.WineVarieties.ToDictionary(v => v.SortId, v => v);
var attrs = ctx.WineAttributes.ToDictionary(a => a.AttrId, a => a);
return entries

View File

@ -4,8 +4,8 @@ using System;
namespace Elwig.Helpers.Billing {
public class Varibute : IComparable<Varibute> {
public WineVar? Variety { get; }
public WineAttr? Attribute { get; }
public readonly WineVar? Variety;
public readonly WineAttr? Attribute;
public string Listing => $"{Variety?.SortId}{Attribute?.AttrId}";
public string FullName => $"{Variety?.Name}" + (Variety != null && Attribute != null ? " " : "") + $"{Attribute?.Name}";