mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-25 11:44:37 +00:00
Combine analytics and game types (#839)
## Description: Combine analytics and game types. Simplify and remove redundant player information. - Remove ip address. - Add playerID. - Combine redundant player tables. - Move game metadata in to GameEndInfo type, an extension of GameStartInfo ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced - [x] I understand that submitting code with bugs that could have been caught through manual testing blocks releases and new features for all contributors --------- Co-authored-by: Scott Anderson <662325+scottanderson@users.noreply.github.com>
This commit is contained in:
@@ -187,9 +187,10 @@ export class ClientGameRunner {
|
||||
}
|
||||
|
||||
private saveGame(update: WinUpdate) {
|
||||
if (this.myPlayer === null) throw new Error("Not initialized");
|
||||
const players: PlayerRecord[] = [
|
||||
{
|
||||
ip: null,
|
||||
playerID: this.myPlayer.id(),
|
||||
persistentID: getPersistentIDFromCookie(),
|
||||
username: this.lobby.playerName,
|
||||
clientID: this.lobby.clientID,
|
||||
@@ -210,7 +211,7 @@ export class ClientGameRunner {
|
||||
}
|
||||
const record = createGameRecord(
|
||||
this.lobby.gameStartInfo.gameID,
|
||||
this.lobby.gameStartInfo,
|
||||
this.lobby.gameStartInfo.config,
|
||||
players,
|
||||
// Not saving turns locally
|
||||
[],
|
||||
|
||||
@@ -47,7 +47,7 @@ export function endGame(gameRecord: GameRecord) {
|
||||
}
|
||||
|
||||
const stats = getStats();
|
||||
const gameStat = stats[gameRecord.id];
|
||||
const gameStat = stats[gameRecord.info.gameID];
|
||||
|
||||
if (!gameStat) {
|
||||
consolex.log("LocalPersistantStats: game not found");
|
||||
|
||||
@@ -176,7 +176,7 @@ export class LocalServer {
|
||||
}
|
||||
const players: PlayerRecord[] = [
|
||||
{
|
||||
ip: null,
|
||||
playerID: this.lobbyConfig.clientID, // hack?
|
||||
persistentID: getPersistentIDFromCookie(),
|
||||
username: this.lobbyConfig.playerName,
|
||||
clientID: this.lobbyConfig.clientID,
|
||||
@@ -188,7 +188,7 @@ export class LocalServer {
|
||||
}
|
||||
const record = createGameRecord(
|
||||
this.lobbyConfig.gameStartInfo.gameID,
|
||||
this.lobbyConfig.gameStartInfo,
|
||||
this.lobbyConfig.gameStartInfo.config,
|
||||
players,
|
||||
this.turns,
|
||||
this.startedAt,
|
||||
|
||||
+1
-1
@@ -291,7 +291,7 @@ class Client {
|
||||
playerName: this.usernameInput?.getCurrentUsername() ?? "",
|
||||
token: localStorage.getItem("token") ?? getPersistentIDFromCookie(),
|
||||
clientID: lobby.clientID,
|
||||
gameStartInfo: lobby.gameStartInfo ?? lobby.gameRecord?.gameStartInfo,
|
||||
gameStartInfo: lobby.gameStartInfo ?? lobby.gameRecord?.info,
|
||||
gameRecord: lobby.gameRecord,
|
||||
},
|
||||
() => {
|
||||
|
||||
Reference in New Issue
Block a user