Use new current month/day forms.

This commit is contained in:
Dominik Pantůček 2023-06-22 21:51:08 +02:00
parent 03520fc63b
commit fc0d87cbdd
4 changed files with 51 additions and 45 deletions

View file

@ -451,19 +451,21 @@
(make-ldict
'((highlights . ((123 "Interesting..." 0 info)))))))
(test-true brmember-destroyed?
(parameterize ((*current-month* (make-cal-month 2023 2)))
(with-current-month
(make-cal-month 2023 2)
(brmember-destroyed?
(make-ldict `((info . ,(make-ldict
`((member . (,(make-cal-period
(make-cal-month 2010 1)
(make-cal-month 2010 5))))))))))))
(test-false brmember-destroyed?
(with-current-month
(make-cal-month 2009 2)
(brmember-destroyed?
(make-ldict `((info . ,(make-ldict
`((member . (,(make-cal-period
(make-cal-month 2010 1)
(make-cal-month 2001 1)
(make-cal-month 2010 5))))))))))))
(test-false brmember-destroyed?
(parameterize ((*current-month* (make-cal-month 2009 2)))
(brmember-destroyed?
(make-ldict `((info . ,(make-ldict
`((member . (,(make-cal-period
(make-cal-month 2001 1)
(make-cal-month 2010 5))))))))))))
(test-false brmember-suspended?
(brmember-suspended?
(make-ldict `((info . ,(make-ldict
@ -471,27 +473,30 @@
(make-cal-month 2015 1)
#f))))))))))
(test-true brmember-suspended?
(parameterize ((*current-month* (make-cal-month 2015 2)))
(brmember-suspended?
(make-ldict `((info . ,(make-ldict
`((member . (,(make-cal-period
(make-cal-month 2015 1)
#f)))
(suspend ,(make-cal-period
(make-cal-month 2010 1)
(make-cal-month 2022 4) #f #f))))))))))
(test-true brmember-suspended?
(parameterize ((*current-month* (make-cal-month 2015 2)))
(brmember-suspended?
(make-ldict `((info . ,(make-ldict
`((member . (,(make-cal-period
(make-cal-month 2015 1)
#f)))
(suspend (make-cal-period
(with-current-month
(make-cal-month 2015 2)
(brmember-suspended?
(make-ldict `((info . ,(make-ldict
`((member . (,(make-cal-period
(make-cal-month 2015 1)
#f)))
(suspend ,(make-cal-period
(make-cal-month 2010 1)
#f #f #f))))))))))
(make-cal-month 2022 4) #f #f))))))))))
(test-true brmember-suspended?
(with-current-month
(make-cal-month 2015 2)
(brmember-suspended?
(make-ldict `((info . ,(make-ldict
`((member . (,(make-cal-period
(make-cal-month 2015 1)
#f)))
(suspend (make-cal-period
(make-cal-month 2010 1)
#f #f #f))))))))))
(test-false brmember-suspended?
(parameterize ((*current-month* (make-cal-month 2023 2)))
(with-current-month
(make-cal-month 2023 2)
(brmember-suspended?
(make-ldict `((info . ,(make-ldict
`((member . (,(make-cal-period
@ -501,16 +506,17 @@
(make-cal-month 2022 4)
#f #f))))))))))
(test-true brmember-active?
(parameterize ((*current-month* (make-cal-month 2023 2)))
(brmember-active?
(make-ldict `((info . ,(make-ldict
`((member . (,(make-cal-period
(make-cal-month 2015 1)
#f)))
(suspend ,(make-cal-period
(make-cal-month 2010 1)
(make-cal-month 2022 4)
#f #f))))))))))
(with-current-month
(make-cal-month 2023 2)
(brmember-active?
(make-ldict `((info . ,(make-ldict
`((member . (,(make-cal-period
(make-cal-month 2015 1)
#f)))
(suspend ,(make-cal-period
(make-cal-month 2010 1)
(make-cal-month 2022 4)
#f #f))))))))))
))
)

View file

@ -236,8 +236,8 @@
(let mloop ((data '())
(month (members-base-oldest-month mb)))
(if (cal-month<? month (*current-month*))
(let ((bi (parameterize ((*current-month* month))
(mbase-info mb))))
(let ((bi (with-current-month month
(mbase-info mb))))
(let kloop ((row (list (ldict-ref bi 'month)))
(keys (cdr keys)))
(if (null? keys)

View file

@ -83,9 +83,9 @@
(reverse cal)
(loop (cal-month-add cm)
(cons (list cm
(parameterize ((*current-month* cm)
(*current-day* (cal-ensure-day cm)))
(brmember-flags mr)))
(with-current-month
cm
(brmember-flags mr)))
cal))))))
;; Returns the first month of the calendar

View file

@ -268,8 +268,8 @@
(bank-transaction-message bt)
(if (eq? curr 'CZK)
amt
(parameterize ((*current-month* (cal-ensure-month day)))
(* amt (lookup-eur-rate))))
(with-current-day day
(* amt (lookup-eur-rate))))
"Payment")))
bts))