Refactor budget phases step progress functions and usage

This commit is contained in:
Bertocq
2018-01-18 17:14:58 +01:00
parent b48fb7a41e
commit 7599eb4c35
3 changed files with 4 additions and 4 deletions

View File

@@ -41,7 +41,7 @@ class Budget < ActiveRecord::Base
end
def published_phases
phases.published
phases.published.order(:id)
end
def description

View File

@@ -56,7 +56,7 @@ class Budget
end
def step_number
budget.published_phases.order(:id).index(self) + 1 || 0
budget.published_phases.index(self) + 1 || 0
end
private

View File

@@ -16,8 +16,8 @@
</div>
<div class="small-12 medium-3 column info padding" data-equalizer-watch>
<p>
<% steps_progress = "(#{current_phase.step_number}/#{@budget.published_phases.count})" %>
<strong><%= t('budgets.show.phase') %> <%= steps_progress %></strong>
<% steps = "(#{@budget.current_phase.step_number}/#{@budget.published_phases.count})" %>
<strong><%= t('budgets.show.phase') %> <%= steps %></strong>
</p>
<h2><%= t("budgets.phase.#{@budget.phase}") %></h2>