diff --git a/BGS/Report.cs b/BGS/Report.cs index 9814b21..33621d3 100644 --- a/BGS/Report.cs +++ b/BGS/Report.cs @@ -50,11 +50,29 @@ namespace EliteBGS.BGS { } public void Scan(PlayerJournal journal, DateTime start, DateTime end) { - var entries = from file in journal.Files - where file.NormalisedDateTime >= start && file.NormalisedDateTime <= end - select file.Entries - ; - Scan(entries.SelectMany(x => x).ToList()); + /* Log files only get rotated if you restart the game client. This means that there might + * be - say - entries from the 4th of May in the file with a timestamp of 3rd of May. This + * happens if you happen to play a session late into the night. + * At first I tried extracting the first and last line of a file to see the date range, but + * if you have a lot of files this becomes quite slow, and quite the memory hog (as journal + * files have to be read in their entirety to check this). So we assume that you can't play + * three days straight, and keep the code fast. + */ + DateTime actualstart = start.AddDays(-3); + List entries = journal.Files + .Where(f => f.NormalisedDateTime >= actualstart && f.NormalisedDateTime <= end) + .SelectMany(e => e.Entries) + .ToList() + ; + // Now further sort the list down to entries that are actually within the given datetime + // Note that entry datetimes are not normalised, so we have to sort until end + 1 day + DateTime actualend = end.AddDays(1); + + entries = entries + .Where(e => e.Timestamp >= start && e.Timestamp < actualend) + .ToList() + ; + Scan(entries); } public void Scan(List entries) { diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f9b0f5..ea399c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # EliteBGS changelog +## 0.1.x on XX.06.2022 + +* Fixed a bug where entries in non-rated journal files were not properly picked up. + ## 0.1.2 on 06.04.2022 * If you remove an item the tree items stay collapsed/expanded. (thanks CMDR NeedX).