Readd function to display survey mean
This commit is contained in:
parent
8b58bf57ef
commit
0fa59dd858
|
@ -28,6 +28,15 @@ func init() {
|
||||||
})(ps, body)
|
})(ps, body)
|
||||||
})(uauth, ps, body)
|
})(uauth, ps, body)
|
||||||
}, loggedUser))
|
}, loggedUser))
|
||||||
|
router.GET("/api/surveys/:sid/grades", apiAuthHandler(surveyAuthHandler(func(s Survey, uauth *User, _ []byte) HTTPResponse {
|
||||||
|
if scores, err := s.GetGrades(); err != nil {
|
||||||
|
return APIErrorResponse{err: err}
|
||||||
|
} else if scores == nil {
|
||||||
|
return APIResponse{"N/A"}
|
||||||
|
} else {
|
||||||
|
return APIResponse{scores}
|
||||||
|
}
|
||||||
|
}), adminRestricted))
|
||||||
router.GET("/api/grades", apiAuthHandler(func(uauth *User, ps httprouter.Params, body []byte) HTTPResponse {
|
router.GET("/api/grades", apiAuthHandler(func(uauth *User, ps httprouter.Params, body []byte) HTTPResponse {
|
||||||
if uauth != nil && uauth.IsAdmin {
|
if uauth != nil && uauth.IsAdmin {
|
||||||
if score, err := GetAllGrades(); err != nil {
|
if score, err := GetAllGrades(); err != nil {
|
||||||
|
|
Reference in New Issue