Improved periods display, basic multi-value handling for credit, card, desfire keys.
This commit is contained in:
parent
5a68b1870e
commit
7d08bff69f
1 changed files with 32 additions and 3 deletions
|
@ -285,6 +285,20 @@
|
|||
#t
|
||||
(loop (cdr ps))))))
|
||||
|
||||
;; Returns string representing a month period with possibly open end.
|
||||
(define (period->string p)
|
||||
(sprintf "~A..~A"
|
||||
(month->string (car p))
|
||||
(if (cdr p)
|
||||
(month->string (cdr p))
|
||||
"....-..")))
|
||||
|
||||
;; Returns a string representing a list of periods.
|
||||
(define (periods->string ps)
|
||||
(string-intersperse
|
||||
(map period->string ps)
|
||||
", "))
|
||||
|
||||
(define (period-tests!)
|
||||
(display "[test] period ")
|
||||
(unit-test 'sort-period-markers
|
||||
|
@ -326,6 +340,13 @@
|
|||
(not (month-in-periods? '(((2022 1) . (2022 4))
|
||||
((2023 5) . (2023 10)))
|
||||
'(2022 10))))
|
||||
(unit-test 'period->string
|
||||
(equal? (period->string '((2022 1) . (2022 4)))
|
||||
"2022-01..2022-04"))
|
||||
(unit-test 'periods->string
|
||||
(equal? (periods->string '(((2022 1) . (2022 4))
|
||||
((2022 12). (2023 2))))
|
||||
"2022-01..2022-04, 2022-12..2023-02"))
|
||||
(print " ok."))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
@ -375,7 +396,10 @@
|
|||
(dict-set d pk
|
||||
(cons (cons pd (string->month ds))
|
||||
(dict-ref d pk '()))))))
|
||||
(dict-set d k v))))
|
||||
(case k
|
||||
((card desfire credit) (dict-set d k (cons v (dict-ref d k '()))))
|
||||
(else
|
||||
(dict-set d k v))))))
|
||||
|
||||
;; Converts given key in member info dictionary from period markers
|
||||
;; list to periods.
|
||||
|
@ -664,8 +688,13 @@
|
|||
(print "User " id " alias " name)
|
||||
(let loop ((sinfo sinfo))
|
||||
(when (not (null? sinfo))
|
||||
(let ((kv (car sinfo)))
|
||||
(print " " (car kv) ":\t" (cdr kv))
|
||||
(let* ((kv (car sinfo))
|
||||
(k (car kv))
|
||||
(v (cdr kv)))
|
||||
(print " " k ":\t"
|
||||
(if (member k '(student suspend))
|
||||
(periods->string v)
|
||||
v))
|
||||
(loop (cdr sinfo))))))
|
||||
(let ()
|
||||
(print "No such member " (member-parm) ".")))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue