Skip to content

Commit

Permalink
add ability to retrieve/edit vanilla pp leaderboard preference on use…
Browse files Browse the repository at this point in the history
…rs/self/settings (#59)
  • Loading branch information
tsunyoku authored Jun 1, 2024
1 parent 327f1c6 commit 0cf8ce8
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions app/v1/self.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ type userSettingsData struct {
singleBadge
Show *bool `json:"show"`
} `json:"custom_badge"`
PlayStyle *int `json:"play_style"`
PlayStyle *int `json:"play_style"`
VanillaPPLeaderboards *bool `json:"vanilla_pp_leaderboards"`
}

// UsersSelfSettingsPOST allows to modify information about the current user.
Expand Down Expand Up @@ -86,7 +87,8 @@ func UsersSelfSettingsPOST(md common.MethodData) common.CodeMessager {
Add("custom_badge_name", d.CustomBadge.Name).
Add("custom_badge_icon", d.CustomBadge.Icon).
Add("show_custom_badge", d.CustomBadge.Show).
Add("play_style", d.PlayStyle)
Add("play_style", d.PlayStyle).
Add("vanilla_pp_leaderboards", d.VanillaPPLeaderboards)
_, err := md.DB.Exec("UPDATE users SET "+q.Fields()+" WHERE id = ?", append(q.Parameters, md.ID())...)
if err != nil {
md.Err(err)
Expand Down Expand Up @@ -114,14 +116,14 @@ SELECT
email, username_aka, favourite_mode,
show_custom_badge, custom_badge_icon,
custom_badge_name, can_custom_badge,
play_style
play_style, vanilla_pp_leaderboards
FROM users
WHERE id = ?`, md.ID()).Scan(
&r.ID, &r.Username,
&r.Email, &r.UsernameAKA, &r.FavouriteMode,
&r.CustomBadge.Show, &r.CustomBadge.Icon,
&r.CustomBadge.Name, &ccb,
&r.PlayStyle,
&r.PlayStyle, &r.VanillaPPLeaderboards,
)
if err != nil {
md.Err(err)
Expand Down

0 comments on commit 0cf8ce8

Please sign in to comment.