Make RetrievePlaytime pull time directly from save

This commit is contained in:
Pancakes 2025-04-25 12:53:03 -04:00
parent 857bdee976
commit add5fbc326
No known key found for this signature in database
GPG Key ID: 5792877BFA27DC8F
2 changed files with 12 additions and 13 deletions

View File

@ -199,11 +199,11 @@ func FetchLastLoggedInDateByUsername(username string) (string, error) {
}
type AdminSearchResponse struct {
Username string `json:"username"`
DiscordId string `json:"discordId"`
GoogleId string `json:"googleId"`
LastActivity string `json:"lastLoggedIn"` // TODO: this is currently lastLoggedIn to match server PR #54 with pokerogue PR #4198. We're hotfixing the server with this PR to return lastActivity, but we're not hotfixing the client, so are leaving this as lastLoggedIn so that it still talks to the client properly
Registered string `json:"registered"`
Username string `json:"username"`
DiscordId string `json:"discordId"`
GoogleId string `json:"googleId"`
LastActivity string `json:"lastLoggedIn"` // TODO: this is currently lastLoggedIn to match server PR #54 with pokerogue PR #4198. We're hotfixing the server with this PR to return lastActivity, but we're not hotfixing the client, so are leaving this as lastLoggedIn so that it still talks to the client properly
Registered string `json:"registered"`
}
func FetchAdminDetailsByUsername(dbUsername string) (AdminSearchResponse, error) {
@ -216,11 +216,11 @@ func FetchAdminDetailsByUsername(dbUsername string) (AdminSearchResponse, error)
}
adminResponse = AdminSearchResponse{
Username: username.String,
DiscordId: discordId.String,
GoogleId: googleId.String,
LastActivity: lastActivity.String,
Registered: registered.String,
Username: username.String,
DiscordId: discordId.String,
GoogleId: googleId.String,
LastActivity: lastActivity.String,
Registered: registered.String,
}
return adminResponse, nil

View File

@ -219,13 +219,12 @@ func DeleteSessionSaveData(uuid []byte, slot int) error {
}
func RetrievePlaytime(uuid []byte) (int, error) {
var playtime int
err := handle.QueryRow("SELECT playTime FROM accountStats WHERE uuid = ?", uuid).Scan(&playtime)
system, err := ReadSystemSaveData(uuid)
if err != nil {
return 0, err
}
return playtime, nil
return int(system.GameStats.(map[string]interface{})["playTime"].(float64)), nil
}
func GetSystemSaveFromS3(uuid []byte) (defs.SystemSaveData, error) {