fix entries in non-rated files not being picked up
Thanks to CMDR Shakaka
This commit is contained in:
parent
7d7f80c555
commit
431c83fc23
@ -50,11 +50,29 @@ namespace EliteBGS.BGS {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void Scan(PlayerJournal journal, DateTime start, DateTime end) {
|
public void Scan(PlayerJournal journal, DateTime start, DateTime end) {
|
||||||
var entries = from file in journal.Files
|
/* Log files only get rotated if you restart the game client. This means that there might
|
||||||
where file.NormalisedDateTime >= start && file.NormalisedDateTime <= end
|
* be - say - entries from the 4th of May in the file with a timestamp of 3rd of May. This
|
||||||
select file.Entries
|
* 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<Entry> entries = journal.Files
|
||||||
|
.Where(f => f.NormalisedDateTime >= actualstart && f.NormalisedDateTime <= end)
|
||||||
|
.SelectMany(e => e.Entries)
|
||||||
|
.ToList()
|
||||||
;
|
;
|
||||||
Scan(entries.SelectMany(x => x).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<Entry> entries) {
|
public void Scan(List<Entry> entries) {
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
# EliteBGS changelog
|
# 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
|
## 0.1.2 on 06.04.2022
|
||||||
|
|
||||||
* If you remove an item the tree items stay collapsed/expanded. (thanks CMDR NeedX).
|
* If you remove an item the tree items stay collapsed/expanded. (thanks CMDR NeedX).
|
||||||
|
Loading…
Reference in New Issue
Block a user