diff --git a/app/models/card/multistep.rb b/app/models/card/multistep.rb index ccd3a9786..e69b07e6f 100644 --- a/app/models/card/multistep.rb +++ b/app/models/card/multistep.rb @@ -4,8 +4,4 @@ module Card::Multistep included do has_many :steps, dependent: :destroy end - - def completed_steps_count - steps.where(completed: true).count - end end diff --git a/app/models/step.rb b/app/models/step.rb index 7451832c9..c4e35f33e 100644 --- a/app/models/step.rb +++ b/app/models/step.rb @@ -1,6 +1,8 @@ class Step < ApplicationRecord belongs_to :card, touch: true + scope :completed, -> { where(completed: true) } + def completed? completed end diff --git a/app/views/cards/display/preview/_steps.html.erb b/app/views/cards/display/preview/_steps.html.erb index 091bae458..e3d7588cd 100644 --- a/app/views/cards/display/preview/_steps.html.erb +++ b/app/views/cards/display/preview/_steps.html.erb @@ -3,6 +3,6 @@ <%= icon_tag "check" %> - <%= "#{card.completed_steps_count}/#{card.steps.count}" %> + <%= "#{card.steps.completed.count}/#{card.steps.count}" %> <% end %> \ No newline at end of file