Remove unused budget attributes
Tags and help links can be edited, but aren't used anywhere. Since we don't know what the intended behavior was, I'm removing them for now. My best guess is tags were supposed to be used so investments for a budget can only be assigned tags present in the budget. Achieving that behavior wouldn't be a trivial task.
This commit is contained in:
@@ -70,9 +70,6 @@ class Admin::BudgetsController < Admin::BaseController
|
||||
descriptions = Budget::Phase::PHASE_KINDS.map { |p| "description_#{p}" }.map(&:to_sym)
|
||||
valid_attributes = [:phase,
|
||||
:currency_symbol,
|
||||
:help_link,
|
||||
:milestone_tag_list,
|
||||
:valuation_tag_list,
|
||||
administrator_ids: [],
|
||||
valuator_ids: [],
|
||||
tracker_ids: []
|
||||
|
||||
@@ -54,10 +54,7 @@ module BudgetsHelper
|
||||
end
|
||||
|
||||
def investment_tags_select_options(budget, context)
|
||||
taggables = [budget] + budget.investments
|
||||
Tag.joins(:taggings)
|
||||
.merge(Tagging.where(taggable: taggables, context: context))
|
||||
.distinct.order(:name).pluck(:name)
|
||||
budget.investments.tags_on(context).order(:name).pluck(:name)
|
||||
end
|
||||
|
||||
def unfeasible_or_unselected_filter
|
||||
|
||||
@@ -4,9 +4,6 @@ class Budget < ApplicationRecord
|
||||
include StatsVersionable
|
||||
include Reportable
|
||||
|
||||
acts_as_taggable_on :valuation_tags
|
||||
acts_as_taggable_on :milestone_tags
|
||||
|
||||
translates :name, touch: true
|
||||
include Globalizable
|
||||
|
||||
|
||||
@@ -38,22 +38,6 @@
|
||||
<%= render "/admin/budgets/association", assignable_type: "trackers", assignables: @trackers, form: f %>
|
||||
</div>
|
||||
|
||||
<div class="margin-top">
|
||||
<div class="small-12 medium-9 column end">
|
||||
<%= f.text_field :milestone_tag_list,
|
||||
value: @budget.milestone_tag_list.sort.join(","),
|
||||
placeholder: t("admin.budget_investments.edit.tags_placeholder") %>
|
||||
</div>
|
||||
<div class="small-12 medium-9 column end">
|
||||
<%= f.text_field :valuation_tag_list,
|
||||
value: @budget.valuation_tag_list.sort.join(","),
|
||||
placeholder: t("admin.budget_investments.edit.tags_placeholder") %>
|
||||
</div>
|
||||
<div class="small-12 medium-9 column end">
|
||||
<%= f.text_field :help_link %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% if @budget.phases.present? %>
|
||||
<div class="row">
|
||||
<div class="small-12 column">
|
||||
|
||||
@@ -141,9 +141,6 @@ en:
|
||||
description_finished: "Description when the budget is finished"
|
||||
phase: "Phase"
|
||||
currency_symbol: "Currency"
|
||||
milestone_tag_list: "Milestone tags"
|
||||
valuation_tag_list: "Valuation tags"
|
||||
help_link: "Help link"
|
||||
budget/translation:
|
||||
name: "Name"
|
||||
budget/investment:
|
||||
|
||||
@@ -143,9 +143,6 @@ es:
|
||||
description_finished: "Descripción cuando el presupuesto ha finalizado / Resultados"
|
||||
phase: "Fase"
|
||||
currency_symbol: "Divisa"
|
||||
milestone_tag_list: "Etiquetas de seguimiento"
|
||||
valuation_tag_list: "Etiquetas de evaluación"
|
||||
help_link: "Enlace de ayuda"
|
||||
budget/translation:
|
||||
name: "Nombre"
|
||||
budget/investment:
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
class RemoveHelpLinkFromBudgets < ActiveRecord::Migration[5.0]
|
||||
def change
|
||||
remove_column :budgets, :help_link, :string
|
||||
remove_column :tags, :budgets_count, :integer, default: 0
|
||||
end
|
||||
end
|
||||
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20191031173943) do
|
||||
ActiveRecord::Schema.define(version: 20191031210734) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
@@ -407,7 +407,6 @@ ActiveRecord::Schema.define(version: 20191031173943) do
|
||||
t.text "description_drafting"
|
||||
t.text "description_publishing_prices"
|
||||
t.text "description_informing"
|
||||
t.string "help_link"
|
||||
end
|
||||
|
||||
create_table "campaigns", force: :cascade do |t|
|
||||
@@ -1485,8 +1484,6 @@ ActiveRecord::Schema.define(version: 20191031173943) do
|
||||
t.integer "budget/investments_count", default: 0
|
||||
t.integer "legislation/proposals_count", default: 0
|
||||
t.integer "legislation/processes_count", default: 0
|
||||
t.integer "budgets_count", default: 0
|
||||
t.index ["budgets_count"], name: "index_tags_on_budgets_count", using: :btree
|
||||
t.index ["debates_count"], name: "index_tags_on_debates_count", using: :btree
|
||||
t.index ["legislation/processes_count"], name: "index_tags_on_legislation/processes_count", using: :btree
|
||||
t.index ["legislation/proposals_count"], name: "index_tags_on_legislation/proposals_count", using: :btree
|
||||
|
||||
Reference in New Issue
Block a user