1
0
Fork 0
empact/server/stat.go

57 lines
1.5 KiB
Go
Raw Normal View History

2015-03-06 16:29:26 +00:00
package server
import (
"net/http"
2015-03-08 11:17:56 +00:00
"github.com/fatih/structs"
2015-03-06 16:29:26 +00:00
"github.com/localhots/empact/db"
)
2015-03-08 11:17:56 +00:00
func statOrgTopHandler(w http.ResponseWriter, r *http.Request) {
2015-03-07 14:56:02 +00:00
req, stat := parseRequest(w, r)
2015-03-08 11:17:56 +00:00
top := db.StatOrgTop(structs.Map(stat))
2015-03-07 14:56:02 +00:00
req.respondWith(top)
2015-03-06 16:29:26 +00:00
}
2015-03-08 11:17:56 +00:00
func statOrgActivityHandler(w http.ResponseWriter, r *http.Request) {
2015-03-07 14:56:02 +00:00
req, stat := parseRequest(w, r)
2015-03-08 11:17:56 +00:00
activity := db.StatOrgActivity(structs.Map(stat))
2015-03-07 14:56:02 +00:00
req.respondWith(activity)
2015-03-06 16:29:26 +00:00
}
2015-03-08 11:17:56 +00:00
func statTeamTopHandler(w http.ResponseWriter, r *http.Request) {
2015-03-07 14:56:02 +00:00
req, stat := parseRequest(w, r)
2015-03-08 11:17:56 +00:00
top := db.StatTeamTop(structs.Map(stat))
2015-03-07 14:56:02 +00:00
req.respondWith(top)
2015-03-06 16:29:26 +00:00
}
2015-03-08 11:17:56 +00:00
func statTeamActivityHandler(w http.ResponseWriter, r *http.Request) {
2015-03-07 14:56:02 +00:00
req, stat := parseRequest(w, r)
2015-03-08 11:17:56 +00:00
activity := db.StatTeamActivity(structs.Map(stat))
2015-03-07 14:56:02 +00:00
req.respondWith(activity)
2015-03-06 16:29:26 +00:00
}
2015-03-08 14:35:25 +00:00
func statUserTopHandler(w http.ResponseWriter, r *http.Request) {
req, stat := parseRequest(w, r)
top := db.StatUserTop(structs.Map(stat))
req.respondWith(top)
}
func statUserActivityHandler(w http.ResponseWriter, r *http.Request) {
req, stat := parseRequest(w, r)
activity := db.StatUserActivity(structs.Map(stat))
req.respondWith(activity)
}
func statRepoTopHandler(w http.ResponseWriter, r *http.Request) {
req, stat := parseRequest(w, r)
top := db.StatRepoTop(structs.Map(stat))
req.respondWith(top)
}
func statRepoActivityHandler(w http.ResponseWriter, r *http.Request) {
req, stat := parseRequest(w, r)
activity := db.StatRepoActivity(structs.Map(stat))
req.respondWith(activity)
}