Class: CodeSunset::Feature

Inherits:
ApplicationRecord show all
Defined in:
app/models/code_sunset/feature.rb

Constant Summary collapse

STATUSES =
%w[active cooling_down candidate_for_removal safe_to_remove].freeze

Instance Method Summary collapse

Instance Method Details

#computed_status(last_seen_at: nil, reference_time: Time.current) ⇒ Object



17
18
19
# File 'app/models/code_sunset/feature.rb', line 17

def computed_status(last_seen_at: nil, reference_time: Time.current)
  CodeSunset::StatusEngine.new(feature: self, last_seen_at: last_seen_at, reference_time: reference_time).status
end

#removal_score(snapshot = nil) ⇒ Object



21
22
23
24
# File 'app/models/code_sunset/feature.rb', line 21

def removal_score(snapshot = nil)
  snapshot ||= CodeSunset::FeatureQuery.new({}, scope: self.class.where(id: id)).call.first
  CodeSunset::ScoreCalculator.new(feature: self, snapshot: snapshot).score
end