Work on calendar formatting.
This commit is contained in:
parent
2a6b364b4a
commit
3e9b421f60
3 changed files with 45 additions and 1 deletions
|
@ -32,6 +32,7 @@
|
|||
member-calendar-first-month
|
||||
member-calendar-last-month
|
||||
member-calendar-query
|
||||
member-calendar->years-table
|
||||
member-calendar->fees
|
||||
)
|
||||
|
||||
|
@ -72,6 +73,37 @@
|
|||
(define (member-calendar-query mc m)
|
||||
(assoc m mc))
|
||||
|
||||
;; Formats the calendar entry for visualization
|
||||
(define (member-calendar-entry->string e)
|
||||
(if e
|
||||
(if (member 'existing (cadr e))
|
||||
"EEE"
|
||||
" ")
|
||||
" "))
|
||||
|
||||
;; Converts the calendar into a table where rows represent years and
|
||||
;; contain the year in the first cell and 12 cells for months after
|
||||
;; it.
|
||||
(define (member-calendar->years-table mc)
|
||||
(let* ((fm (member-calendar-first-month mc))
|
||||
(lm (member-calendar-last-month mc))
|
||||
(fy (month-year fm))
|
||||
(ly (month-year lm)))
|
||||
(let loop ((y fy)
|
||||
(rows '()))
|
||||
(if (> y ly)
|
||||
(reverse rows)
|
||||
(loop (add1 y)
|
||||
(cons (let mloop ((m 1)
|
||||
(row (list y)))
|
||||
(if (> m 12)
|
||||
(reverse row)
|
||||
(mloop (add1 m)
|
||||
(cons (member-calendar-entry->string
|
||||
(member-calendar-query mc (make-month y m)))
|
||||
row))))
|
||||
rows))))))
|
||||
|
||||
(define (member-calendar->fees mr)
|
||||
#f)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue