collate vouchers together
This commit is contained in:
		
							parent
							
								
									34934c82a6
								
							
						
					
					
						commit
						32e5898b02
					
				| @ -1,5 +1,6 @@ | |||||||
| using System.Linq; | using System.Linq; | ||||||
| using System.Text; | using System.Text; | ||||||
|  | using System.Xml.Schema; | ||||||
| using EDPlayerJournal; | using EDPlayerJournal; | ||||||
| using EDPlayerJournal.BGS; | using EDPlayerJournal.BGS; | ||||||
| 
 | 
 | ||||||
| @ -8,10 +9,10 @@ namespace EliteBGS.LogGenerator; | |||||||
| public class VoucherFormat : LogFormatter { | public class VoucherFormat : LogFormatter { | ||||||
|     public string GenerateLog(Objective objective) { |     public string GenerateLog(Objective objective) { | ||||||
|         StringBuilder builder = new StringBuilder(); |         StringBuilder builder = new StringBuilder(); | ||||||
|         var missions = objective.UITransactions |         var missions = objective | ||||||
|             .Where(x => x.IsEnabled) |             .EnabledOfType<Vouchers>() | ||||||
|             .Select(x => x.Transaction) |             .GroupBy(x => x.Type) | ||||||
|             .OfType<Vouchers>() |             .ToDictionary(x => x.Key, x => x.ToList()) | ||||||
|             ; |             ; | ||||||
| 
 | 
 | ||||||
|         if (missions == null || missions.Count() <= 0) { |         if (missions == null || missions.Count() <= 0) { | ||||||
| @ -19,7 +20,8 @@ public class VoucherFormat : LogFormatter { | |||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         foreach (var m in missions) { |         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(); |         return builder.ToString().Trim(); | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user