X-Git-Url: https://nos-oignons.net/gitweb/gestion-adh.git/blobdiff_plain/9abd734720ddad01338b0556ed6210bac5c5b145..6a086c6afe926f02597b81b21b58000166b2c885:/lib/nos_oignons/member.rb diff --git a/lib/nos_oignons/member.rb b/lib/nos_oignons/member.rb index 7e6254e..8b0bd97 100644 --- a/lib/nos_oignons/member.rb +++ b/lib/nos_oignons/member.rb @@ -1,6 +1,8 @@ require 'safe_yaml' SafeYAML::OPTIONS[:default_mode] = :safe +require 'nos_oignons/reminder_db' + module NosOignons MEMBER_FIELDS = [:name, :address, :email, :joined_on, :membership_fee_paid_on] MEMBER_MANDATORY_FIELDS = [:name, :email] @@ -19,7 +21,7 @@ module NosOignons if File.exists?(File.join(git_path, MEMBERS_DB_DIR)) @db_path = File.join(git_path, MEMBERS_DB_DIR) else - @db_path = File.join(File.expand_path('../wiki-ca', path), MEMBERS_DB_DIR) + @db_path = File.join(File.expand_path('../wiki-ca', git_path), MEMBERS_DB_DIR) end end @db_path @@ -78,9 +80,18 @@ module NosOignons def up_to_date? return false if !joined_on || !membership_fee_paid_on - now = Time.now.to_date + today = Time.now.to_date expire_on = Time.new(membership_fee_paid_on.year + 1, joined_on.month, joined_on.day).to_date - now <= expire_on + today <= expire_on + end + + def remind(reminder) + reminder.send(self) + ReminderDb.instance.record(self) + end + + def reminded_on + ReminderDb.instance.last_reminder(self) end end end