Compute stats.

This commit is contained in:
Dominik Pantůček 2023-03-19 19:00:09 +01:00
parent 5f62bb319e
commit 5ff4aaff1b

View file

@ -54,7 +54,8 @@
primes
member-record
ansi
period)
period
month)
;; Gets all files and symbolic links from given directory. The
;; symbolic links are represented by cons cells with car being the
@ -280,11 +281,21 @@
;; Returns a list two lists: keys, data.
;; Each data record contains values for all keys.
(define (members-base-stats . args)
(define (members-base-stats mb)
(let ((keys '(month total active suspended students destroyed invalid)))
(let mloop ((data '())
(month '(2015 1))) ; TODO: *oldest-month*
#f)))
(month (*member-default-joined*)))
(if (month<? month (*current-month*))
(let ((bi (parameterize ((*current-month* month))
(members-base-info mb))))
(let kloop ((row '())
(keys keys))
(if (null? keys)
(mloop (cons (reverse row) data)
(month-add month 1))
(kloop (cons (dict-ref bi (car keys)) row)
(cdr keys)))))
(list keys (reverse data))))))
;; Basic information about members-base in human-readable form.
(define (print-members-base-info mb)