Fix handling joined in the base.

This commit is contained in:
Dominik Pantůček 2023-03-19 19:32:56 +01:00
parent 6a53913e48
commit cd6051e376
3 changed files with 10 additions and 6 deletions

View file

@ -80,6 +80,8 @@
(-stats (fname) "Get stats for all months"
(-action- 'print-stats)
(-fname- fname))
(-month (month) "Specify current month"
(*current-month* (string->month month)))
)
;; Load the members database (required for everything anyway)

View file

@ -1,4 +1,4 @@
set terminal pngcairo size 800,600
set terminal pngcairo size 1000,600
set title "Members stats"
set output 'members-base-stats.png'
@ -13,6 +13,8 @@ set ylabel "Members"
set grid
set key out right
plot[][0:] \
src u 1:3 w l t 'active', \
src u 1:4 w l t 'suspended', \

View file

@ -265,8 +265,9 @@
mrs))))
;; Returns dictionary with statistics about the members base.
(define (members-base-info mb)
(let* ((di0 (make-dict))
(define (members-base-info mb-arg)
(let* ((mb (filter-members-by-predicate mb-arg member-existing?))
(di0 (make-dict))
(di1 (dict-set di0 'invalid
(filter-members-by-predicate mb
(compose not is-4digit-prime? member-id))))
@ -284,9 +285,8 @@
;; Returns a list two lists: keys, data.
;; Each data record contains values for all keys.
(define (members-base-stats mb-arg)
(let ((keys '(month total active suspended students destroyed invalid))
(mb (filter-members-by-predicate mb-arg member-existing?)))
(define (members-base-stats mb)
(let ((keys '(month total active suspended students destroyed invalid)))
(let mloop ((data '())
(month (*member-default-joined*)))
(if (month<? month (*current-month*))