module Consentable
Public Instance Methods
Source
# File app/models/concerns/consentable.rb, line 18 def can_receive_consent? !close_consent_at.nil? && Date.current <= close_consent_at end
Source
# File app/models/concerns/consentable.rb, line 8 def close_consent_at return nil if dates.empty? dates.max - 1.day end
Source
# File app/models/concerns/consentable.rb, line 13 def consent_deadline_date next_date = future_dates.first next_date ? (next_date - 1.day) : close_consent_at end
Source
# File app/models/concerns/consentable.rb, line 34 def next_reminder_date = next_reminder_dates.first end
Source
# File app/models/concerns/consentable.rb, line 27 def next_reminder_dates return [] if days_before_consent_reminders.nil? reminder_dates = dates.map { it - days_before_consent_reminders.days } reminder_dates.select(&:future?) end
Source
# File app/models/concerns/consentable.rb, line 6 def open_consent_at = send_consent_requests_at def close_consent_at return nil if dates.empty? dates.max - 1.day end def consent_deadline_date next_date = future_dates.first next_date ? (next_date - 1.day) : close_consent_at end def can_receive_consent? !close_consent_at.nil? && Date.current <= close_consent_at end def open_for_consent? can_receive_consent? && !open_consent_at.nil? && Date.current >= open_consent_at end def next_reminder_dates return [] if days_before_consent_reminders.nil? reminder_dates = dates.map { it - days_before_consent_reminders.days } reminder_dates.select(&:future?) end def next_reminder_date = next_reminder_dates.first
Source
# File app/models/concerns/consentable.rb, line 22 def open_for_consent? can_receive_consent? && !open_consent_at.nil? && Date.current >= open_consent_at end