62 lines
1.7 KiB
Scheme
62 lines
1.7 KiB
Scheme
;;
|
|
;; member-fees.scm
|
|
;;
|
|
;; Member fees manipulation.
|
|
;;
|
|
;; ISC License
|
|
;;
|
|
;; Copyright 2023 Brmlab, z.s.
|
|
;; Dominik Pantůček <dominik.pantucek@trustica.cz>
|
|
;;
|
|
;; Permission to use, copy, modify, and/or distribute this software
|
|
;; for any purpose with or without fee is hereby granted, provided
|
|
;; that the above copyright notice and this permission notice appear
|
|
;; in all copies.
|
|
;;
|
|
;; THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
|
|
;; WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
|
|
;; WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
|
|
;; AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
|
|
;; CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
|
;; OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
|
|
;; NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
|
;; CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
;;
|
|
|
|
(declare (unit member-fees))
|
|
|
|
(module
|
|
member-fees
|
|
(
|
|
member-calendar
|
|
member-calendar->fees
|
|
)
|
|
|
|
(import scheme
|
|
(chicken base)
|
|
configuration
|
|
member-record
|
|
month)
|
|
|
|
;; Returns a list of months where each month is a list containing:
|
|
;; * month (from month module)
|
|
;; * flags - a list of symbols: student, suspended, destroyed
|
|
;; The list contains all months from 'joined until (*current-month*).
|
|
(define (member-calendar mr . args)
|
|
(let ((last-month (if (null? args)
|
|
(*current-month*)
|
|
(car args))))
|
|
(let loop ((cm (member-record-info mr 'joined))
|
|
(cal '()))
|
|
(if (month>? cm last-month)
|
|
(reverse cal)
|
|
(loop (month-add cm)
|
|
(cons (list cm
|
|
(parameterize ((*current-month* cm))
|
|
(member-flags mr)))
|
|
cal))))))
|
|
|
|
(define (member-calendar->fees mr)
|
|
#f)
|
|
|
|
)
|