2022-11-24 19:38:19 +01:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using EDPlayerJournal.BGS;
|
|
|
|
|
|
|
|
|
|
namespace EliteBGS;
|
|
|
|
|
|
|
|
|
|
public class Report {
|
|
|
|
|
public List<Objective> Objectives { get; set; } = new List<Objective>();
|
|
|
|
|
|
|
|
|
|
public Report() { }
|
|
|
|
|
|
|
|
|
|
public Report(List<Transaction> transactions) {
|
|
|
|
|
Populate(transactions);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Populate(List<Transaction> transactions) {
|
|
|
|
|
if (transactions == null || transactions.Count == 0) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach (Transaction t in transactions) {
|
2022-12-03 15:01:46 +01:00
|
|
|
|
Objective o;
|
|
|
|
|
if (t.SystemContribution) {
|
|
|
|
|
o = Objectives.Find(x => x.Matches(t.System));
|
|
|
|
|
} else {
|
|
|
|
|
o = Objectives.Find(x => x.Matches(t.System, t.Faction));
|
|
|
|
|
}
|
2022-11-24 19:38:19 +01:00
|
|
|
|
|
|
|
|
|
if (o == null) {
|
2022-12-03 15:01:46 +01:00
|
|
|
|
if (t.SystemContribution) {
|
|
|
|
|
o = new Objective() { System = t.System };
|
|
|
|
|
} else {
|
|
|
|
|
o = new Objective() { Faction = t.Faction, System = t.System };
|
|
|
|
|
}
|
2022-11-24 19:38:19 +01:00
|
|
|
|
Objectives.Add(o);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
o.UITransactions.Add(new UITransaction(t));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|