mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-11 00:14:00 +00:00
feat(multiplayer): expose ranked season countdown
This commit is contained in:
@@ -11,7 +11,10 @@ import (
|
||||
const RankedProfileSelectSQL = `SELECT rating, deviation, volatility, ranked_games, updated_at,
|
||||
COALESCE((SELECT season_id FROM seasons
|
||||
WHERE playlist = 'ranked' AND starts_at <= CURRENT_TIMESTAMP AND ends_at > CURRENT_TIMESTAMP
|
||||
ORDER BY starts_at DESC, season_id DESC LIMIT 1), '')
|
||||
ORDER BY starts_at DESC, season_id DESC LIMIT 1), ''),
|
||||
COALESCE((SELECT ends_at FROM seasons
|
||||
WHERE playlist = 'ranked' AND starts_at <= CURRENT_TIMESTAMP AND ends_at > CURRENT_TIMESTAMP
|
||||
ORDER BY starts_at DESC, season_id DESC LIMIT 1), TIMESTAMP 'epoch')
|
||||
FROM ratings
|
||||
WHERE player_id = $1`
|
||||
|
||||
@@ -34,7 +37,7 @@ func (p PostgresRankedProfiles) Get(ctx context.Context, playerID string) (domai
|
||||
}
|
||||
var profile domain.RankedProfile
|
||||
err := p.DB.QueryRowContext(ctx, RankedProfileSelectSQL, playerID).
|
||||
Scan(&profile.Value, &profile.RD, &profile.Volatility, &profile.RankedGames, &profile.LastRatedAt, &profile.CurrentSeasonID)
|
||||
Scan(&profile.Value, &profile.RD, &profile.Volatility, &profile.RankedGames, &profile.LastRatedAt, &profile.CurrentSeasonID, &profile.CurrentSeasonEndsAt)
|
||||
if err == sql.ErrNoRows {
|
||||
return domain.RankedProfile{}, false, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user