aboutsummaryrefslogtreecommitdiffstats
path: root/webstats/server.lisp
diff options
context:
space:
mode:
authorOscar Najera <hi@oscarnajera.com>2025-02-10 02:08:51 +0100
committerOscar Najera <hi@oscarnajera.com>2025-02-10 02:08:51 +0100
commit0967597ff39c925bd746223b994922e632a0c98e (patch)
treeb732389062227b84aedce0d5044cd4d68c9ceb1d /webstats/server.lisp
parent7b90ec0b14a0114f055a26e2f29f92a3f771c87e (diff)
downloadscratch-0967597ff39c925bd746223b994922e632a0c98e.tar.gz
scratch-0967597ff39c925bd746223b994922e632a0c98e.tar.bz2
scratch-0967597ff39c925bd746223b994922e632a0c98e.zip
stats for separate domains
Diffstat (limited to 'webstats/server.lisp')
-rw-r--r--webstats/server.lisp15
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)))))))))))