Skip to content

Commit cea37cf

Browse files
committed
fix(stats): report correctly resolved side instead of random in custom matches
1 parent 6a9f71b commit cea37cf

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

GenOnlineService/Controllers/Lobby/LobbyController.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@ public async Task<APIResult> Delete(Int64 lobbyID)
302302
&& data.ContainsKey("units_lost")
303303
&& data.ContainsKey("total_money")
304304
&& data.ContainsKey("won")
305+
&& data.ContainsKey("side")
305306
)
306307
{
307308
Int64 user_id = TokenHelper.GetUserID(this);
@@ -318,6 +319,7 @@ public async Task<APIResult> Delete(Int64 lobbyID)
318319
int units_killed = data["units_killed"].GetInt32();
319320
int units_lost = data["units_lost"].GetInt32();
320321
int total_money = data["total_money"].GetInt32();
322+
int side = data["side"].GetInt32();
321323
bool won = data["won"].GetBoolean();
322324
UInt64 match_id = data["match_id"].GetUInt64();
323325

@@ -337,7 +339,7 @@ public async Task<APIResult> Delete(Int64 lobbyID)
337339

338340
// store in DB
339341
await using var db = await _dbFactory.CreateDbContextAsync();
340-
await Database.MatchHistory.CommitPlayerOutcome(db, slotIndexInLobby, match_id,
342+
await Database.MatchHistory.CommitPlayerOutcome(db, slotIndexInLobby, match_id, side,
341343
buildings_built, buildings_killed, buildings_lost, units_built, units_killed, units_lost, total_money, won);
342344
}
343345
}

GenOnlineService/Database/Database.MatchHistory.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,7 @@ public static async Task CommitPlayerOutcome(
331331
AppDbContext db,
332332
int slotIndex,
333333
ulong matchId,
334+
int side,
334335
int buildingsBuilt,
335336
int buildingsKilled,
336337
int buildingsLost,
@@ -357,6 +358,7 @@ public static async Task CommitPlayerOutcome(
357358

358359
// 3. Update fields
359360
MatchdataMemberModel model = modelNullable.Value;
361+
model.side = side;
360362
model.buildings_built = buildingsBuilt;
361363
model.buildings_killed = buildingsKilled;
362364
model.buildings_lost = buildingsLost;

0 commit comments

Comments
 (0)