Modifier migration

This commit is contained in:
2023-08-17 23:06:40 +02:00
parent 58235e3b02
commit 0d609c1013
5 changed files with 12 additions and 9 deletions

View File

@ -105,7 +105,7 @@ namespace Elwig.Models {
public virtual ISet<DeliveryPartModifier> PartModifiers { get; private set; }
[NotMapped]
public IEnumerable<Modifier> Modifiers => PartModifiers.Select(m => m.Modifier);
public IEnumerable<Modifier> Modifiers => PartModifiers.Select(m => m.Modifier).OrderBy(m => m.Ordering);
public string OriginString => Origin.OriginString + "\n" + (Kg?.Gl != null ? $" / {Kg.Gl.Name}" : "") + (Kg != null ? $" / {Kg.AtKg.Gem.Name} / KG {Kg.AtKg.Name}" : "") + (Rd != null ? $" / Ried {Rd.Name}" : "");
}

View File

@ -11,6 +11,9 @@ namespace Elwig.Models {
[Column("modid")]
public string ModId { get; set; }
[Column("ordering")]
public int Ordering { get; set; }
[Column("name")]
public string Name { get; set; }
@ -39,9 +42,9 @@ namespace Elwig.Models {
[ForeignKey("Year")]
public virtual Season Season { get; private set; }
public string ValueStr => (Abs != null) ?
$"{(Abs < 0 ? " -" : "+")}{Math.Abs(Abs.Value)} {Season.Currency.Symbol}/kg" :
$"{(Rel < 0 ? " -" : "+")}{Math.Abs(Rel.Value):P2}";
public string ValueStr =>
(Abs != null) ? $"{(Abs.Value < 0 ? "\u00a0-" : "+")}{Math.Abs(Abs.Value)}\u00a0{Season.Currency.Symbol}/kg" :
(Rel != null) ? $"{(Rel.Value < 0 ? "\u00a0-" : "+")}{(Math.Abs(Rel.Value) < 0.1 ? "\u2007" : "")}{Math.Abs(Rel.Value):0.00##\u00a0%}" : "";
public override string ToString() {
return Name;