Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion GenOnlineService/Controllers/Lobby/LobbyController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ public async Task<APIResult> Delete(Int64 lobbyID)
&& data.ContainsKey("won")
&& data.ContainsKey("side")
&& data.ContainsKey("desynced")
&& data.ContainsKey("duration")
)
{
Int64 user_id = TokenHelper.GetUserID(this);
Expand All @@ -323,6 +324,7 @@ public async Task<APIResult> Delete(Int64 lobbyID)
int side = data["side"].GetInt32();
bool won = data["won"].GetBoolean();
bool desynced = data["desynced"].GetBoolean();
uint duration = data["duration"].GetUInt32();
UInt64 match_id = data["match_id"].GetUInt64();

// were they really in the match they claim to be in?
Expand Down Expand Up @@ -359,7 +361,7 @@ public async Task<APIResult> Delete(Int64 lobbyID)
// store in DB
await using var db = await _dbFactory.CreateDbContextAsync();
await Database.MatchHistory.CommitPlayerOutcome(db, slotIndexInLobby, match_id, side,
buildings_built, buildings_killed, buildings_lost, units_built, units_killed, units_lost, total_money, won, desynced);
buildings_built, buildings_killed, buildings_lost, units_built, units_killed, units_lost, total_money, won, desynced, duration);
}
}
}
Expand Down
6 changes: 5 additions & 1 deletion GenOnlineService/Database/Database.MatchHistory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,8 @@ public struct MatchdataMemberModel
[JsonConverter(typeof(BoolFromIntConverter))]
public bool desynced {get; set; } = false;

public uint? duration { get; set; } = null;

public List<MemberMetadataModel> metadata { get; set; } = new List<MemberMetadataModel>();

public MatchdataMemberModel()
Expand Down Expand Up @@ -373,7 +375,8 @@ public static async Task CommitPlayerOutcome(
int unitsLost,
int totalMoney,
bool won,
bool desynced)
bool desynced,
uint duration)
{
if (slotIndex < 0 || slotIndex > 7)
return;
Expand Down Expand Up @@ -402,6 +405,7 @@ public static async Task CommitPlayerOutcome(
model.total_money = totalMoney;
model.won = won;
model.desynced = desynced;
model.duration = duration;

// 4. Serialize back
string updatedJson = JsonSerializer.Serialize(model);
Expand Down
Loading