c4498212dc
* main: (116 commits) Ensure avatar thumbnails are square Update useragent to recognize twitterbot/facebot Add defensive styles for non-square avatar images Update test for copy changes Missed commit AI: standardize on https://agents.md Make it clear this is just notifications, not comprehensive activity AI: configure MCP servers for Chrome, Grafana, and Sentry (#1727) Allow requests from Google Image Proxy Update to basecamp's useragent fork Clean up a little bit the CSRF reporting code Claude: production observability guidance (#1725) Prevent autoscroll to the root columns container to prevent jump on page load Include full name string so you can type your name to filter Prioritize current user and assigned users in assignment dropdown Check and report on Sec-Fetch-Site header for forgery protection bundle update Bump bootsnap from 1.18.6 to 1.19.0 Bump rails from `077c3ad` to `17f6e00` Fix cards getting stuck in edit mode ...
42 lines
1.6 KiB
Ruby
42 lines
1.6 KiB
Ruby
module Card::Entropic
|
|
extend ActiveSupport::Concern
|
|
|
|
included do
|
|
scope :due_to_be_postponed, -> do
|
|
active
|
|
.joins(board: :account)
|
|
.left_outer_joins(board: :entropy)
|
|
.joins("LEFT OUTER JOIN entropies AS account_entropies ON account_entropies.account_id = accounts.id AND account_entropies.container_type = 'Account' AND account_entropies.container_id = accounts.id")
|
|
.where("last_active_at <= #{connection.date_subtract('?', 'COALESCE(entropies.auto_postpone_period, account_entropies.auto_postpone_period)')}", Time.now)
|
|
end
|
|
|
|
scope :postponing_soon, -> do
|
|
now = Time.now
|
|
active
|
|
.joins(board: :account)
|
|
.left_outer_joins(board: :entropy)
|
|
.joins("LEFT OUTER JOIN entropies AS account_entropies ON account_entropies.account_id = accounts.id AND account_entropies.container_type = 'Account' AND account_entropies.container_id = accounts.id")
|
|
.where("last_active_at > #{connection.date_subtract('?', 'COALESCE(entropies.auto_postpone_period, account_entropies.auto_postpone_period)')}", now)
|
|
.where("last_active_at <= #{connection.date_subtract('?', 'COALESCE(entropies.auto_postpone_period, account_entropies.auto_postpone_period) * 0.75')}", now)
|
|
end
|
|
|
|
delegate :auto_postpone_period, to: :board
|
|
end
|
|
|
|
class_methods do
|
|
def auto_postpone_all_due
|
|
due_to_be_postponed.find_each do |card|
|
|
card.auto_postpone(user: card.account.system_user)
|
|
end
|
|
end
|
|
end
|
|
|
|
def entropy
|
|
Card::Entropy.for(self)
|
|
end
|
|
|
|
def entropic?
|
|
entropy.present?
|
|
end
|
|
end
|