From 72d984757621014c5ac3cb49c870ffa35677f957 Mon Sep 17 00:00:00 2001 From: Mikhail Babynichev Date: Fri, 8 Apr 2022 00:10:50 +0300 Subject: [PATCH] fix: sql queries --- models/beatmap.go | 2 +- models/set.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/models/beatmap.go b/models/beatmap.go index 78a8a79..cbe9083 100644 --- a/models/beatmap.go +++ b/models/beatmap.go @@ -155,7 +155,7 @@ func FetchBeatmapsChimu(db *sql.DB, ids ...int) ([]BeatmapChimu, error) { return nil, nil } - q := `SELECT ` + beatmapFields + `, sets.artist, sets.title, sets.creator FROM beatmaps RIGHT JOIN sets ON sets.id = beatmaps.parent_set_id FROM beatmaps WHERE id IN (` + inClause(len(ids)) + `)` + q := `SELECT ` + beatmapFields + `, sets.artist, sets.title, sets.creator FROM beatmaps RIGHT JOIN sets ON sets.id = beatmaps.parent_set_id WHERE sets.id IN (` + inClause(len(ids)) + `)` rows, err := db.Query(q, sIntToSInterface(ids)...) if err != nil { diff --git a/models/set.go b/models/set.go index f3d63b8..d9b88c0 100644 --- a/models/set.go +++ b/models/set.go @@ -137,7 +137,7 @@ func FetchSetChimu(db *sql.DB, id int, withChildren bool) (*SetChimu, error) { return &s, nil } - rows, err := db.Query(`SELECT `+beatmapFields+` FROM beatmaps WHERE parent_set_id = ?`, s.ID) + rows, err := db.Query(`SELECT `+beatmapFields+`, sets.artist, sets.title, sets.creator FROM beatmaps RIGHT JOIN sets ON sets.id = beatmaps.parent_set_id WHERE beatmaps.parent_set_id = ?`, s.ID) if err != nil { return nil, err } -- GitLab