DataTable: Add units for columns
This commit is contained in:
@ -8,19 +8,19 @@ using System.Threading.Tasks;
|
||||
namespace Elwig.Models.Dtos {
|
||||
public class AreaComUnderDeliveryData : DataTable<AreaComUnderDeliveryRow> {
|
||||
|
||||
private static readonly (string, string, int)[] FieldNames = new[] {
|
||||
("MgNr", "MgNr.", 12),
|
||||
("Name", "Name", 40),
|
||||
("GivenName", "Vorname", 40),
|
||||
("Address", "Adresse", 60),
|
||||
("Plz", "PLZ", 10),
|
||||
("Locality", "Ort", 60),
|
||||
("VtrgIds", "Vertrag", 14),
|
||||
("Areas", "Fläche", 16),
|
||||
("DeliveryObligations", "Lieferpflicht", 22),
|
||||
("Weights", "Geliefert", 22),
|
||||
("UnderDeliveries", "Unterliefert", 22),
|
||||
("Percents", "Prozent", 16),
|
||||
private static readonly (string, string, string?, int)[] FieldNames = new[] {
|
||||
("MgNr", "MgNr.", null, 12),
|
||||
("Name", "Name", null, 40),
|
||||
("GivenName", "Vorname", null, 40),
|
||||
("Address", "Adresse", null, 60),
|
||||
("Plz", "PLZ", null, 10),
|
||||
("Locality", "Ort", null, 60),
|
||||
("VtrgIds", "Vertrag", null, 14),
|
||||
("Areas", "Fläche", "m²", 16),
|
||||
("DeliveryObligations", "Lieferpflicht", "kg", 22),
|
||||
("Weights", "Geliefert", "kg", 22),
|
||||
("UnderDeliveries", "Unterliefert", "kg", 22),
|
||||
("Percents", "Prozent", "%", 16),
|
||||
};
|
||||
|
||||
public AreaComUnderDeliveryData(IEnumerable<AreaComUnderDeliveryRow> rows, int year) :
|
||||
@ -65,7 +65,7 @@ namespace Elwig.Models.Dtos {
|
||||
.Select(v => v.First < v.Second ? (int?)v.First - v.Second : null)
|
||||
.ToArray();
|
||||
public double?[] Percents => Weights.Zip(DeliveryObligations)
|
||||
.Select(v => v.First < v.Second ? (double?)Math.Round(v.First * 100.0 / v.Second - 100.0, 1) : null)
|
||||
.Select(v => v.First < v.Second ? (double?)v.First * 100.0 / v.Second - 100.0 : null)
|
||||
.ToArray();
|
||||
|
||||
public AreaComUnderDeliveryRow(IEnumerable<AreaComUnderDeliveryRowSingle> rows) {
|
||||
|
Reference in New Issue
Block a user