From 32e5898b0258fecb9737adc4f1b916301b37ad72 Mon Sep 17 00:00:00 2001 From: Florian Stinglmayr Date: Fri, 25 Nov 2022 17:56:43 +0100 Subject: [PATCH] collate vouchers together --- EliteBGS/LogGenerator/VoucherFormat.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/EliteBGS/LogGenerator/VoucherFormat.cs b/EliteBGS/LogGenerator/VoucherFormat.cs index f15e727..a45db87 100644 --- a/EliteBGS/LogGenerator/VoucherFormat.cs +++ b/EliteBGS/LogGenerator/VoucherFormat.cs @@ -1,5 +1,6 @@ using System.Linq; using System.Text; +using System.Xml.Schema; using EDPlayerJournal; using EDPlayerJournal.BGS; @@ -8,10 +9,10 @@ namespace EliteBGS.LogGenerator; public class VoucherFormat : LogFormatter { public string GenerateLog(Objective objective) { StringBuilder builder = new StringBuilder(); - var missions = objective.UITransactions - .Where(x => x.IsEnabled) - .Select(x => x.Transaction) - .OfType() + var missions = objective + .EnabledOfType() + .GroupBy(x => x.Type) + .ToDictionary(x => x.Key, x => x.ToList()) ; if (missions == null || missions.Count() <= 0) { @@ -19,7 +20,8 @@ public class VoucherFormat : LogFormatter { } foreach (var m in missions) { - builder.AppendFormat("Handed in {0} vouchers: {1}\n", m.Type, Credits.FormatCredits(m.TotalSum)); + ulong total = (ulong)m.Value.Sum(x => (decimal)x.TotalSum); + builder.AppendFormat("Handed in {0} vouchers: {1}\n", m.Key, Credits.FormatCredits(total)); } return builder.ToString().Trim();