Sort surveys by promo first, then start_date
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
f3fd0be2b8
commit
2c20b9dc50
|
@ -15,11 +15,11 @@ func init() {
|
||||||
router.GET("/api/surveys", apiAuthHandler(
|
router.GET("/api/surveys", apiAuthHandler(
|
||||||
func(u *User, _ httprouter.Params, _ []byte) HTTPResponse {
|
func(u *User, _ httprouter.Params, _ []byte) HTTPResponse {
|
||||||
if u == nil {
|
if u == nil {
|
||||||
return formatApiResponse(getSurveys(fmt.Sprintf("WHERE shown = TRUE AND NOW() > start_availability AND promo = %d", currentPromo)))
|
return formatApiResponse(getSurveys(fmt.Sprintf("WHERE shown = TRUE AND NOW() > start_availability AND promo = %d ORDER BY start_availability ASC", currentPromo)))
|
||||||
} else if u.IsAdmin {
|
} else if u.IsAdmin {
|
||||||
return formatApiResponse(getSurveys(""))
|
return formatApiResponse(getSurveys("ORDER BY promo DESC, start_availability ASC"))
|
||||||
} else {
|
} else {
|
||||||
return formatApiResponse(getSurveys(fmt.Sprintf("WHERE shown = TRUE AND promo = %d", u.Promo)))
|
return formatApiResponse(getSurveys(fmt.Sprintf("WHERE shown = TRUE AND promo = %d ORDER BY start_availability ASC", u.Promo)))
|
||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
router.POST("/api/surveys", apiHandler(func(_ httprouter.Params, body []byte) HTTPResponse {
|
router.POST("/api/surveys", apiHandler(func(_ httprouter.Params, body []byte) HTTPResponse {
|
||||||
|
|
Reference in New Issue