diff --git a/driver/web/apis_admin.go b/driver/web/apis_admin.go index 9075f6d..8bcee01 100644 --- a/driver/web/apis_admin.go +++ b/driver/web/apis_admin.go @@ -21,6 +21,7 @@ import ( "io/ioutil" "log" "net/http" + "sort" "strconv" "strings" "time" @@ -250,6 +251,12 @@ func (h AdminAPIsHandler) getSurveys(l *logs.Log, r *http.Request, claims *token return l.HTTPResponseErrorAction(logutils.ActionGet, model.TypeSurvey, nil, err, http.StatusInternalServerError, true) } + surveys := surveysToSurveyRequests(resData) + + sort.Slice(surveys, func(i, j int) bool { + return surveys[i].DateCreated.After(surveys[j].DateCreated) + }) + rdata, err := json.Marshal(resData) if err != nil { return l.HTTPResponseErrorAction(logutils.ActionMarshal, logutils.TypeResponseBody, nil, err, http.StatusInternalServerError, false)