Change BudgetInvestmentStatus to Milestone::Status

Generalize the BudgetInvestmentStatus model to Milestone::Status so it
is not specific to budget investments, but can be used for any entity
which has milestones. This is in preparation to make the Milestone
model polymorphic and usable by entities other than budget investments.
This commit is contained in:
Marko Lovic
2018-07-16 13:13:30 +02:00
committed by Javi Martín
parent 7446ebbdd5
commit 81f516efd7
27 changed files with 187 additions and 165 deletions

View File

@@ -139,16 +139,16 @@ section "Creating Valuation Assignments" do
end
end
section "Creating default Investment Milestone Statuses" do
Budget::Investment::Status.create(name: I18n.t('seeds.budgets.statuses.studying_project'))
Budget::Investment::Status.create(name: I18n.t('seeds.budgets.statuses.bidding'))
Budget::Investment::Status.create(name: I18n.t('seeds.budgets.statuses.executing_project'))
Budget::Investment::Status.create(name: I18n.t('seeds.budgets.statuses.executed'))
section "Creating default Milestone Statuses" do
Milestone::Status.create(name: I18n.t('seeds.budgets.statuses.studying_project'))
Milestone::Status.create(name: I18n.t('seeds.budgets.statuses.bidding'))
Milestone::Status.create(name: I18n.t('seeds.budgets.statuses.executing_project'))
Milestone::Status.create(name: I18n.t('seeds.budgets.statuses.executed'))
end
section "Creating investment milestones" do
Budget::Investment.find_each do |investment|
milestone = Budget::Investment::Milestone.new(investment_id: investment.id, publication_date: Date.tomorrow)
milestone = Budget::Investment::Milestone.new(investment_id: investment.id, publication_date: Date.tomorrow, status_id: Milestone::Status.all.sample)
I18n.available_locales.map do |locale|
Globalize.with_locale(locale) do
milestone.description = "Description for locale #{locale}"