Use new table for member fees calendar, quick hack for problem with SGR and spaces.

This commit is contained in:
Dominik Pantůček 2023-06-15 15:28:07 +02:00
parent eaced78aee
commit 656789e984
2 changed files with 18 additions and 17 deletions

View file

@ -50,7 +50,7 @@
brmember
cal-month
ansi
table-old
table
mbase
cal-period
specification)
@ -104,14 +104,14 @@
(if e
(if (member 'existing (cadr e))
(if (member 'suspended (cadr e))
(ansi-string #:bgdarkgrey " ") ; Suspended
(ansi-string #:bgdarkgrey "__\x1b[0m") ; Suspended
(if (member 'destroyed (cadr e))
(ansi-string #:bgblack "~~") ; Destroyed
(ansi-string #:bgblack "~~\x1b[0m") ; Destroyed
(if (member 'student (cadr e))
(ansi-string #:bgyellow " ") ; Student
(ansi-string #:bggreen " ")))) ; Normal
" ") ; Nonexistent - should not happen
" ")) ; Nonexistent
(ansi-string #:bgyellow "__\x1b[0m") ; Student
(ansi-string #:bggreen "__\x1b[0m")))) ; Normal
"__") ; Nonexistent - should not happen
"__")) ; Nonexistent
;; Converts the entry into the fee
(define (member-calendar-entry->fee e)
@ -171,15 +171,15 @@
;; Nicely print calendar for given member
(define (member-calendar->table mr)
(let* ((mc (member-calendar mr))
(fees (member-calendar->fees mc)))
(table->string (cons (map (lambda (c)
(sprintf "\t~A\t" c))
(list "" 1 2 3 4 5 6 7 8 9 10 11 12))
(member-calendar->years-table mc))
#:table-border #f
#:row-border #t
#:col-border #t
#:ansi #t
(fees (member-calendar->fees mc))
(data (cons (map (lambda (c)
(sprintf "\t~A\t" c))
(list "" 1 2 3 4 5 6 7 8 9 10 11 12))
(member-calendar->years-table mc))))
(table->string data
#:border '(((light #:top #:left none) (light #:top none) ... (light #:top #:right none))
((light #:left none) light ... (light #:right none)) ...
((light #:bottom #:left none) (light #:bottom none) ... (light #:bottom #:right none)))
)))
;; Summarizes (cons students full) counts

View file

@ -113,7 +113,8 @@
(if (and (not (null? res))
(sgr-token-spaces? (car res)))
(reverse (cdr res))
(if (and (not (null? (cdr res)))
(if (and (not (null? res))
(not (null? (cdr res)))
(sgr-state? (car res))
(sgr-token-spaces? (cadr res)))
(reverse (cons (car res)