Don't show questions for preview surveys

This commit is contained in:
nemunaire 2020-03-08 02:18:32 +01:00
parent 0a79763f69
commit 80776bb7a1
4 changed files with 16 additions and 2 deletions

View file

@ -13,7 +13,9 @@ import (
func init() {
router.GET("/api/surveys", apiAuthHandler(
func(u *User, _ httprouter.Params, _ []byte) HTTPResponse {
if u != nil && u.IsAdmin {
if u == nil {
return formatApiResponse(getSurveys("WHERE shown = TRUE AND NOW() > start_availability"))
} else if u.IsAdmin {
return formatApiResponse(getSurveys(""))
} else {
return formatApiResponse(getSurveys("WHERE shown = TRUE"))