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 primes
member-record member-record
ansi ansi
period) period
month)
;; Gets all files and symbolic links from given directory. The ;; Gets all files and symbolic links from given directory. The
;; symbolic links are represented by cons cells with car being the ;; symbolic links are represented by cons cells with car being the
@ -280,11 +281,21 @@
;; Returns a list two lists: keys, data. ;; Returns a list two lists: keys, data.
;; Each data record contains values for all keys. ;; 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 ((keys '(month total active suspended students destroyed invalid)))
(let mloop ((data '()) (let mloop ((data '())
(month '(2015 1))) ; TODO: *oldest-month* (month (*member-default-joined*)))
#f))) (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. ;; Basic information about members-base in human-readable form.
(define (print-members-base-info mb) (define (print-members-base-info mb)