;;; -*- mode: Lisp; Syntax: Common-Lisp; -*- ;;; ;;; Copyright (c) 2009 by the authors. ;;; ;;; See LICENCE for details. (in-package :hu.dwim.number-toss) ;;;;;; ;;; Status entry point (def entry-point (*number-toss-application* :path "status") (disallow-response-caching (make-byte-vector-response ((+header/content-type+ +utf-8-plain-text-content-type+)) (with-database *number-toss-database* (with-new-compiled-query-cache (with-transaction (write-server-status t) (format t "~%") (format t "Number of registered players: ~A~%" (count-instances 'player)) (format t "Number of submitted games: ~A~%" (count-instances 'game)) (format t "Number of submitted challenges: ~A~%" (count-instances 'challenge)) (format t "Number of premium players: ~A~%" (first-elt (select ((count player)) (from (player player)) (where (premium-p player))))) (format t "Number of featured players: ~A~%" (first-elt (select ((count player)) (from (player player)) (where (featured-p player))))) (bind ((player-tags (remove "" (remove-duplicates (mappend (lambda (tags) (split-sequence:split-sequence #\Space tags)) (select (:uniquep #t) ((tags-of player)) (from (player player)))) :test #'string=) :test #'string=))) (format t "List of player tags ~{~A ~}~%" player-tags)) (format t "~%") (iter (for size :from 5 :to 9) (for overall-scoreboard = (overall-scoreboard/ensure size "")) (when overall-scoreboard (format t "Scoreboard (~Ax~A) last refreshed: ~A~%" size size (created-at-of overall-scoreboard)))))))))) ;;;;;; ;;; Statistics entry point (def entry-point (*number-toss-application* :path "statistics") (make-buffered-functional-html-response ((+header/status+ +http-ok+)) (with-database *number-toss-database* (with-new-compiled-query-cache (with-transaction