now we're cooking with gas
This commit is contained in:
parent
69123c57a6
commit
e1ed11d49f
|
@ -267,3 +267,25 @@ func genModeClause(md common.MethodData) string {
|
||||||
}
|
}
|
||||||
return modeClause
|
return modeClause
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func genModeClauseRx(md common.MethodData) string {
|
||||||
|
var modeClause string
|
||||||
|
if md.Query("mode") != "" {
|
||||||
|
m, err := strconv.Atoi(md.Query("mode"))
|
||||||
|
if err == nil && m >= 0 && m <= 3 {
|
||||||
|
modeClause = fmt.Sprintf("AND scores_relac.play_mode = '%d'", m)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return modeClause
|
||||||
|
}
|
||||||
|
|
||||||
|
func genModeClauseAp(md common.MethodData) string {
|
||||||
|
var modeClause string
|
||||||
|
if md.Query("mode") != "" {
|
||||||
|
m, err := strconv.Atoi(md.Query("mode"))
|
||||||
|
if err == nil && m >= 0 && m <= 3 {
|
||||||
|
modeClause = fmt.Sprintf("AND scores_auto.play_mode = '%d'", m)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return modeClause
|
||||||
|
}
|
|
@ -45,7 +45,7 @@ func UserScoresBestAPGET(md common.MethodData) common.CodeMessager {
|
||||||
if cm != nil {
|
if cm != nil {
|
||||||
return *cm
|
return *cm
|
||||||
}
|
}
|
||||||
mc := genModeClause(md)
|
mc := genModeClauseAp(md)
|
||||||
// For all modes that have PP, we leave out 0 PP scores_auto.
|
// For all modes that have PP, we leave out 0 PP scores_auto.
|
||||||
if getMode(md.Query("mode")) != "ctb" {
|
if getMode(md.Query("mode")) != "ctb" {
|
||||||
mc += " AND scores_auto.pp > 0"
|
mc += " AND scores_auto.pp > 0"
|
||||||
|
@ -73,7 +73,7 @@ func UserScoresRecentAPGET(md common.MethodData) common.CodeMessager {
|
||||||
%s
|
%s
|
||||||
AND `+md.User.OnlyUserPublic(true)+`
|
AND `+md.User.OnlyUserPublic(true)+`
|
||||||
ORDER BY scores_auto.id DESC %s`,
|
ORDER BY scores_auto.id DESC %s`,
|
||||||
wc, genModeClause(md), common.Paginate(md.Query("p"), md.Query("l"), 100),
|
wc, genModeClauseAp(md), common.Paginate(md.Query("p"), md.Query("l"), 100),
|
||||||
), param)
|
), param)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ func UserScoresBestRelaxGET(md common.MethodData) common.CodeMessager {
|
||||||
if cm != nil {
|
if cm != nil {
|
||||||
return *cm
|
return *cm
|
||||||
}
|
}
|
||||||
mc := genModeClause(md)
|
mc := genModeClauseRx(md)
|
||||||
// For all modes that have PP, we leave out 0 PP scores_relax.
|
// For all modes that have PP, we leave out 0 PP scores_relax.
|
||||||
if getMode(md.Query("mode")) != "ctb" {
|
if getMode(md.Query("mode")) != "ctb" {
|
||||||
mc += " AND scores_relax.pp > 0"
|
mc += " AND scores_relax.pp > 0"
|
||||||
|
@ -73,7 +73,7 @@ func UserScoresRecentRelaxGET(md common.MethodData) common.CodeMessager {
|
||||||
%s
|
%s
|
||||||
AND `+md.User.OnlyUserPublic(true)+`
|
AND `+md.User.OnlyUserPublic(true)+`
|
||||||
ORDER BY scores_relax.id DESC %s`,
|
ORDER BY scores_relax.id DESC %s`,
|
||||||
wc, genModeClause(md), common.Paginate(md.Query("p"), md.Query("l"), 100),
|
wc, genModeClauseRx(md), common.Paginate(md.Query("p"), md.Query("l"), 100),
|
||||||
), param)
|
), param)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user