Add data for graph of expected income.
This commit is contained in:
parent
b25fbd407d
commit
0e9cfd546b
3 changed files with 18 additions and 8 deletions
|
@ -40,7 +40,8 @@
|
|||
util-bst-ldict
|
||||
primes
|
||||
cal-period
|
||||
cal-month)
|
||||
cal-month
|
||||
members-fees)
|
||||
|
||||
(define (members-base-oldest-month mb)
|
||||
(make-cal-month 2015 1))
|
||||
|
@ -63,18 +64,22 @@
|
|||
(di7 (ldict-set di6 'total members))
|
||||
(di8 (ldict-set di7 'problems
|
||||
(find-members-by-predicate mb-arg brmember-has-problems?)))
|
||||
;; add expected income
|
||||
(di9 (ldict-set di8 'expected
|
||||
(get-expected-income mb-arg)))
|
||||
;; add total balance of all members (including destroyed)
|
||||
;; add total balance of all active members (-only-active -like)
|
||||
;; add average age of active members
|
||||
|
||||
)
|
||||
di8))
|
||||
di9))
|
||||
|
||||
;; Returns a list two lists: keys, data.
|
||||
;; Each data record contains values for all keys.
|
||||
(define (mbase-stats mb)
|
||||
(let ((keys '(month total active suspended students destroyed invalid)))
|
||||
(let ((keys
|
||||
'(month
|
||||
total active suspended students destroyed invalid
|
||||
expected
|
||||
)))
|
||||
(let mloop ((data '())
|
||||
(month (members-base-oldest-month mb)))
|
||||
(if (cal-month<=? month (*current-month*))
|
||||
|
@ -85,7 +90,11 @@
|
|||
(if (null? keys)
|
||||
(mloop (cons (reverse row) data)
|
||||
(cal-month-add month 1))
|
||||
(kloop (cons (length (ldict-ref bi (car keys))) row)
|
||||
(kloop (cons (let ((val (ldict-ref bi (car keys))))
|
||||
(if (list? val)
|
||||
(length val)
|
||||
val))
|
||||
row)
|
||||
(cdr keys)))))
|
||||
(list keys (reverse data))))))
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue