(dp *DataProvider)
| 249 | } |
| 250 | |
| 251 | func handleStats(dp *DataProvider) http.HandlerFunc { |
| 252 | return func(w http.ResponseWriter, r *http.Request) { |
| 253 | dp := effectiveDP(r, dp) |
| 254 | tasks, err := getFilteredTasks(dp, r) |
| 255 | if err != nil { |
| 256 | http.Error(w, err.Error(), http.StatusInternalServerError) |
| 257 | return |
| 258 | } |
| 259 | |
| 260 | m := metrics.Calculate(tasks) |
| 261 | writeJSON(w, m) |
| 262 | } |
| 263 | } |
| 264 | |
| 265 | func handleNext(dp *DataProvider) http.HandlerFunc { |
| 266 | return func(w http.ResponseWriter, r *http.Request) { |