Modifier: Nachkommastellen nach precision

This commit is contained in:
2023-09-04 01:46:54 +02:00
parent 6f4e3474b8
commit cb8d405dcf

View File

@ -2,6 +2,7 @@ using Elwig.Helpers;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using System; using System;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
namespace Elwig.Models { namespace Elwig.Models {
[Table("modifier"), PrimaryKey("Year", "ModId")] [Table("modifier"), PrimaryKey("Year", "ModId")]
@ -46,7 +47,7 @@ namespace Elwig.Models {
public virtual Season Season { get; private set; } public virtual Season Season { get; private set; }
public string ValueStr => public string ValueStr =>
(Abs != null) ? $"{Utils.GetSign(Abs.Value)}{Math.Abs(Abs.Value)}\u00a0{Season.Currency.Symbol}/kg" : (Abs != null) ? $"{Utils.GetSign(Abs.Value)}{Math.Abs(Abs.Value).ToString("0." + string.Concat(Enumerable.Repeat('0', Season.Precision)))}\u00a0{Season.Currency.Symbol}/kg" :
(Rel != null) ? $"{Utils.GetSign(Rel.Value)}{(Math.Abs(Rel.Value) < 0.1m ? "\u2007" : "")}{Math.Abs(Rel.Value):0.00##\u00a0%}" : (Rel != null) ? $"{Utils.GetSign(Rel.Value)}{(Math.Abs(Rel.Value) < 0.1m ? "\u2007" : "")}{Math.Abs(Rel.Value):0.00##\u00a0%}" :
""; "";