Files
fizzy/app/models/collection/entropy.rb
T
Jorge Manrubia 91787a3523 Revamp entropy configuraiton
- Move both settings to its dedicated model entropy configuration
- A collection can have an entropy configuration, or will default to the account if not
2025-06-04 10:41:08 +02:00

22 lines
698 B
Ruby

module Collection::Entropy
extend ActiveSupport::Concern
included do
delegate :auto_close_period, :auto_reconsider_period, to: :entropy_configuration
end
def entropy_configuration
super || Account.sole.default_entropy_configuration
end
def auto_close_period=(new_value)
entropy_configuration ||= association(:entropy_configuration).reader || self.build_entropy_configuration
entropy_configuration.update auto_close_period: new_value
end
def auto_reconsider_period=(new_value)
entropy_configuration ||= association(:entropy_configuration).reader || self.build_entropy_configuration
entropy_configuration.update auto_reconsider_period: new_value
end
end