Simpler
This commit is contained in:
@@ -7,8 +7,7 @@ module Card::Entropy
|
||||
included do
|
||||
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: Entropy::Configuration.default).select(period_name).limit(1))
|
||||
.where("last_active_at <= DATETIME('now', '-' || COALESCE(entropy_configurations.#{period_name}, (?)) || ' seconds')", Entropy::Configuration.default.public_send(period_name))
|
||||
end
|
||||
|
||||
scope :stagnated, -> { doing.entropic_by(:auto_reconsider_period) }
|
||||
|
||||
Reference in New Issue
Block a user