From 2e873ab8bac80b0e5e60dca7b0c1b50d1005e9d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Pant=C5=AF=C4=8Dek?= Date: Sun, 23 Apr 2023 13:30:36 +0200 Subject: [PATCH] Work only with active members in notifications. --- src/members-payments.scm | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/src/members-payments.scm b/src/members-payments.scm index 6ea1d33..ee57365 100644 --- a/src/members-payments.scm +++ b/src/members-payments.scm @@ -217,16 +217,18 @@ ;; Returns true if given member should be notified in given number of months (define (member-to-notify? mr . mmonths) - (let ((months (if (null? mmonths) - 1 - (car mmonths))) - (total (member-total-balance mr)) - (fee (lookup-member-fee (if (brmember-student? mr) - 'student - 'regular)))) - (and (brmember-active? mr) - (< total 0) - (< total (- (* months fee)))))) + (if (member-active? mr) + (let ((months (if (null? mmonths) + 1 + (car mmonths))) + (total (member-total-balance mr)) + (fee (lookup-member-fee (if (brmember-student? mr) + 'student + 'regular)))) + (and (brmember-active? mr) + (< total 0) + (< total (- (* months fee))))) + #f)) ;; Return members to notify because of late payments for more than ;; given number of months