diff options
Diffstat (limited to 'webstats/server.lisp')
-rw-r--r-- | webstats/server.lisp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/webstats/server.lisp b/webstats/server.lisp index a253b91..3fe237a 100644 --- a/webstats/server.lisp +++ b/webstats/server.lisp @@ -54,11 +54,16 @@ (setf (hunchentoot:content-type*) "text/javascript") (ps:ps-compile-file "stats.paren")) -(hunchentoot:define-easy-handler (metric :uri "/metric.json") () +(hunchentoot:define-easy-handler (metric :uri "/metric.json") (q) (setf (hunchentoot:content-type*) "application/json") - (let ((series (activity-stats *sqlite*))) - (cl-json:encode-json-to-string - (apply #'mapcar #'list series)))) + (cl-json:encode-json-to-string + (apply #'mapcar #'list + (cond + ((string= q "all") + (activity-stats *sqlite*)) + ((string= q "split") + (activity-places *sqlite*)) + ((list (list))))))) (hunchentoot:define-easy-handler (graphs :uri "/graphs") () (with-html-string @@ -79,7 +84,7 @@ (add-event-listener "load" (lambda () - (ps:chain (fetch "/stats/metric.json") + (ps:chain (fetch "/stats/metric.json?q=all") (then #'response-to-json) (then #'plot))))))))))) |