lolol i forgot this

This commit is contained in:
Morgan Bazalgette 2018-01-23 22:45:59 +01:00
parent a1eb970382
commit 77ba8aee78
No known key found for this signature in database
GPG Key ID: 40D328300D245DA5

View File

@ -21,6 +21,7 @@ type Achievement struct {
// amount of time. // amount of time.
func LoadAchievementsEvery(db *sqlx.DB, d time.Duration) { func LoadAchievementsEvery(db *sqlx.DB, d time.Duration) {
for { for {
achievs = nil
err := db.Select(&achievs, err := db.Select(&achievs,
"SELECT id, name, description, icon FROM achievements ORDER BY id ASC") "SELECT id, name, description, icon FROM achievements ORDER BY id ASC")
if err != nil { if err != nil {
@ -53,7 +54,7 @@ func UserAchievementsGET(md common.MethodData) common.CodeMessager {
var ids []int var ids []int
err := md.DB.Select(&ids, `SELECT ua.achievement_id FROM users_achievements ua err := md.DB.Select(&ids, `SELECT ua.achievement_id FROM users_achievements ua
INNER JOIN users ON users.id = ua.user_id INNER JOIN users ON users.id = ua.user_id
WHERE `+whereClause, param) WHERE `+whereClause+` ORDER BY ua.achievement_id ASC`, param)
switch { switch {
case err == sql.ErrNoRows: case err == sql.ErrNoRows:
return common.SimpleResponse(404, "No such user!") return common.SimpleResponse(404, "No such user!")