Shortcut to grab the default entropy configuration
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
class Accounts::EntropyConfigurationsController < ApplicationController
|
||||
def update
|
||||
Account.sole.default_entropy_configuration.update!(entropy_configuration_params)
|
||||
Entropy::Configuration.default.update!(entropy_configuration_params)
|
||||
|
||||
redirect_to account_settings_path, notice: "Account updated"
|
||||
end
|
||||
|
||||
@@ -8,7 +8,7 @@ module Card::Entropy
|
||||
scope :entropic_by, ->(period_name) do
|
||||
left_outer_joins(collection: :entropy_configuration)
|
||||
.where("last_active_at <= DATETIME('now', '-' || COALESCE(entropy_configurations.#{period_name}, (?)) || ' seconds')",
|
||||
Entropy::Configuration.where(id: Account.sole.default_entropy_configuration).select(period_name).limit(1))
|
||||
Entropy::Configuration.where(id: Entropy::Configuration.default).select(period_name).limit(1))
|
||||
end
|
||||
|
||||
scope :stagnated, -> { doing.entropic_by(:auto_reconsider_period) }
|
||||
|
||||
@@ -6,7 +6,7 @@ module Collection::Entropy
|
||||
end
|
||||
|
||||
def entropy_configuration
|
||||
super || Account.sole.default_entropy_configuration
|
||||
super || Entropy::Configuration.default
|
||||
end
|
||||
|
||||
def auto_close_period=(new_value)
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
class Entropy::Configuration < ApplicationRecord
|
||||
belongs_to :container, polymorphic: true
|
||||
|
||||
class << self
|
||||
def default
|
||||
Account.sole.default_entropy_configuration
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user