mirror of
https://github.com/WiiLink24/wfc-server.git
synced 2026-09-14 03:25:52 -05:00
SAKE: Support file download requests for rival ghosts from Mario Kart Wii
Helps address issue #43.
This commit is contained in:
@@ -21,6 +21,13 @@ const (
|
||||
"AND courseid = $2 " +
|
||||
"ORDER BY score ASC " +
|
||||
"LIMIT 10"
|
||||
getGhostDataQuery = "" +
|
||||
"SELECT id " +
|
||||
"FROM mario_kart_wii_sake " +
|
||||
"WHERE courseid = $1 " +
|
||||
"AND score < $2 " +
|
||||
"ORDER BY score DESC " +
|
||||
"LIMIT 1"
|
||||
getStoredGhostDataQuery = "" +
|
||||
"SELECT pid, id " +
|
||||
"FROM mario_kart_wii_sake " +
|
||||
@@ -73,6 +80,17 @@ func GetMarioKartWiiTopTenRankings(pool *pgxpool.Pool, ctx context.Context, regi
|
||||
return topTenRankings, nil
|
||||
}
|
||||
|
||||
func GetMarioKartWiiGhostData(pool *pgxpool.Pool, ctx context.Context, courseId common.MarioKartWiiCourseId, time int) (int, error) {
|
||||
row := pool.QueryRow(ctx, getGhostDataQuery, courseId, time)
|
||||
|
||||
var fileId int
|
||||
if err := row.Scan(&fileId); err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
return fileId, nil
|
||||
}
|
||||
|
||||
func GetMarioKartWiiStoredGhostData(pool *pgxpool.Pool, ctx context.Context, regionId common.MarioKartWiiLeaderboardRegionId,
|
||||
courseId common.MarioKartWiiCourseId) (int, int, error) {
|
||||
row := pool.QueryRow(ctx, getStoredGhostDataQuery, regionId, courseId)
|
||||
|
||||
Reference in New Issue
Block a user