Don't display hidden live

This commit is contained in:
nemunaire 2022-09-02 12:00:21 +02:00
parent 4f13efbab1
commit b16c91ac6d
5 changed files with 8 additions and 8 deletions

View file

@ -22,12 +22,12 @@ func declareAPISurveysRoutes(router *gin.RouterGroup) {
var response []*Survey
var err error
if u == nil {
response, err = getSurveys(fmt.Sprintf("WHERE (shown = TRUE OR direct IS NOT NULL) AND NOW() > start_availability AND promo = %d ORDER BY start_availability ASC", currentPromo))
response, err = getSurveys(fmt.Sprintf("WHERE shown = TRUE AND NOW() > start_availability AND promo = %d ORDER BY start_availability ASC", currentPromo))
} else if u.IsAdmin {
response, err = getSurveys("ORDER BY promo DESC, start_availability ASC")
} else {
var surveys []*Survey
surveys, err = getSurveys(fmt.Sprintf("WHERE (shown = TRUE OR direct IS NOT NULL) AND promo = %d ORDER BY start_availability ASC", u.Promo))
surveys, err = getSurveys(fmt.Sprintf("WHERE shown = TRUE AND promo = %d ORDER BY start_availability ASC", u.Promo))
if err == nil {
for _, s := range surveys {
if s.Group == "" || strings.Contains(u.Groups, ","+s.Group+",") {