using System.Collections.Generic; using EDPlayerJournal.BGS; namespace EliteBGS; public class Report { public List Objectives { get; set; } = new List(); public Report() { } public Report(List transactions) { Populate(transactions); } private void Populate(List transactions) { if (transactions == null || transactions.Count == 0) { return; } foreach (Transaction t in transactions) { Objective o; if (t.SystemContribution) { o = Objectives.Find(x => x.Matches(t.System)); } else { o = Objectives.Find(x => x.Matches(t.System, t.Faction)); } if (o == null) { if (t.SystemContribution) { o = new Objective() { System = t.System }; } else { o = new Objective() { Faction = t.Faction, System = t.System }; } Objectives.Add(o); } o.UITransactions.Add(new UITransaction(t)); } } }