File tree Expand file tree Collapse file tree 2 files changed +14
-12
lines changed Expand file tree Collapse file tree 2 files changed +14
-12
lines changed Original file line number Diff line number Diff line change @@ -82,13 +82,13 @@ public async Task<List<Replay>> GetMostRecentReplays(AuthenticationState state)
82
82
return cachedPlayerData ;
83
83
}
84
84
85
- var replays = ( await _context . Players
86
- . Where ( p => p . PlayerGuid == playerGuid )
87
- . Include ( p => p . Replay )
88
- . Include ( r => r . Replay . RoundEndPlayers )
89
- . Select ( p => p . Replay )
90
- . ToListAsync ( )
91
- ) . DistinctBy ( p => p . Id ) ;
85
+ var replays = await _context . Replays
86
+ . AsNoTracking ( )
87
+ . Include ( r => r . RoundEndPlayers )
88
+ . Where ( r => r . RoundEndPlayers != null )
89
+ . Where ( r => r . RoundEndPlayers ! . Any ( p => p . PlayerGuid == playerGuid ) )
90
+ . Distinct ( ) // only need one instance of each replay
91
+ . ToListAsync ( ) ;
92
92
93
93
var charactersPlayed = new List < CharacterData > ( ) ;
94
94
var totalPlaytime = TimeSpan . Zero ;
@@ -99,14 +99,14 @@ public async Task<List<Replay>> GetMostRecentReplays(AuthenticationState state)
99
99
100
100
foreach ( var replay in replays )
101
101
{
102
- if ( replay == null )
103
- {
104
- Log . Warning ( "Replay is null for player with GUID {PlayerGuid}" , playerGuid ) ;
102
+ if ( replay . RoundEndPlayers == null )
105
103
continue ;
106
- }
107
104
108
- if ( replay . RoundEndPlayers == null )
105
+ if ( replay . Date == null )
106
+ {
107
+ Log . Warning ( "Replay with ID {ReplayId} has no date" , replay . Id ) ;
109
108
continue ;
109
+ }
110
110
111
111
if ( replay . Date > lastSeen ) // Update last seen
112
112
{
Original file line number Diff line number Diff line change 4
4
@using ReplayBrowser .Data
5
5
@using Microsoft .AspNetCore .Components .Web
6
6
@using ReplayBrowser .Helpers
7
+ @using Serilog
7
8
@inject AuthenticationStateProvider AuthenticationStateProvider
8
9
@inject ReplayHelper ReplayHelper
9
10
@attribute [StreamRendering]
176
177
FailedToLoad = true ;
177
178
Exception = e ;
178
179
_playerData = new ();
180
+ Log .Error (e , " Failed to load player data." );
179
181
}
180
182
}
181
183
}
You can’t perform that action at this time.
0 commit comments