Merge pull request #2404 from consul/remove_investments_internal_comments
Remove usage of Investment's internal_comments
This commit is contained in:
@@ -41,6 +41,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
|
|||||||
|
|
||||||
### Deprecated
|
### Deprecated
|
||||||
- Budget's `description_*` columns will be erased from database in next release. Please run rake task `budgets:phases:generate_missing` to migrate them. Details at Warning section of https://github.com/consul/consul/pull/2323
|
- Budget's `description_*` columns will be erased from database in next release. Please run rake task `budgets:phases:generate_missing` to migrate them. Details at Warning section of https://github.com/consul/consul/pull/2323
|
||||||
|
- Budget::Investment's `internal_comments` attribute usage was removed, because of https://github.com/consul/consul/pull/2403, run rake task `investments:internal_comments:migrate_to_thread` to migrate existing values to the new internal comments thread. In next release database column will be removed.
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
- Spending Proposals urls from sitemap, that model is getting entirely deprecated soon.
|
- Spending Proposals urls from sitemap, that model is getting entirely deprecated soon.
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ class Valuation::BudgetInvestmentsController < Valuation::BaseController
|
|||||||
def valuation_params
|
def valuation_params
|
||||||
params.require(:budget_investment).permit(:price, :price_first_year, :price_explanation,
|
params.require(:budget_investment).permit(:price, :price_first_year, :price_explanation,
|
||||||
:feasibility, :unfeasibility_explanation,
|
:feasibility, :unfeasibility_explanation,
|
||||||
:duration, :valuation_finished, :internal_comments)
|
:duration, :valuation_finished)
|
||||||
end
|
end
|
||||||
|
|
||||||
def restrict_access_to_assigned_items
|
def restrict_access_to_assigned_items
|
||||||
|
|||||||
@@ -47,11 +47,6 @@
|
|||||||
</p>
|
</p>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% if @investment.internal_comments.present? %>
|
|
||||||
<h2><%= t("valuation.budget_investments.show.internal_comments") %></h2>
|
|
||||||
<%= explanation_field @investment.internal_comments %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
<div class="tabs-panel is-active" id="tab-comments">
|
<div class="tabs-panel is-active" id="tab-comments">
|
||||||
<% unless @comment_tree.nil? %>
|
<% unless @comment_tree.nil? %>
|
||||||
<%= render partial: '/comments/comment_tree', locals: { comment_tree: @comment_tree,
|
<%= render partial: '/comments/comment_tree', locals: { comment_tree: @comment_tree,
|
||||||
|
|||||||
@@ -89,13 +89,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
|
||||||
<div class="small-12 column">
|
|
||||||
<%= f.label :internal_comments, t("valuation.budget_investments.edit.internal_comments_html") %>
|
|
||||||
<%= f.text_area :internal_comments, label: false, rows: 3 %>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="actions small-12 medium-4 column">
|
<div class="actions small-12 medium-4 column">
|
||||||
<%= f.submit(class: "button expanded large", value: t("valuation.budget_investments.edit.save")) %>
|
<%= f.submit(class: "button expanded large", value: t("valuation.budget_investments.edit.save")) %>
|
||||||
|
|||||||
@@ -53,7 +53,6 @@ en:
|
|||||||
undefined: Undefined
|
undefined: Undefined
|
||||||
valuation_finished: Valuation finished
|
valuation_finished: Valuation finished
|
||||||
duration: Time scope
|
duration: Time scope
|
||||||
internal_comments: Internal comments
|
|
||||||
responsibles: Responsibles
|
responsibles: Responsibles
|
||||||
assigned_admin: Assigned admin
|
assigned_admin: Assigned admin
|
||||||
assigned_valuators: Assigned valuators
|
assigned_valuators: Assigned valuators
|
||||||
@@ -71,7 +70,6 @@ en:
|
|||||||
valuation_finished_alert: "Are you sure you want to mark this report as completed? If you do it, it can no longer be modified."
|
valuation_finished_alert: "Are you sure you want to mark this report as completed? If you do it, it can no longer be modified."
|
||||||
not_feasible_alert: "An email will be sent immediately to the author of the project with the report of unfeasibility."
|
not_feasible_alert: "An email will be sent immediately to the author of the project with the report of unfeasibility."
|
||||||
duration_html: Time scope
|
duration_html: Time scope
|
||||||
internal_comments_html: Internal comments
|
|
||||||
save: Save changes
|
save: Save changes
|
||||||
notice:
|
notice:
|
||||||
valuate: "Dossier updated"
|
valuate: "Dossier updated"
|
||||||
|
|||||||
@@ -53,7 +53,6 @@ es:
|
|||||||
undefined: Sin definir
|
undefined: Sin definir
|
||||||
valuation_finished: Informe finalizado
|
valuation_finished: Informe finalizado
|
||||||
duration: Plazo de ejecución
|
duration: Plazo de ejecución
|
||||||
internal_comments: Comentarios internos
|
|
||||||
responsibles: Responsables
|
responsibles: Responsables
|
||||||
assigned_admin: Administrador asignado
|
assigned_admin: Administrador asignado
|
||||||
assigned_valuators: Evaluadores asignados
|
assigned_valuators: Evaluadores asignados
|
||||||
@@ -71,7 +70,6 @@ es:
|
|||||||
valuation_finished_alert: "¿Estás seguro/a de querer marcar este informe como completado? Una vez hecho, no se puede deshacer la acción."
|
valuation_finished_alert: "¿Estás seguro/a de querer marcar este informe como completado? Una vez hecho, no se puede deshacer la acción."
|
||||||
not_feasible_alert: "Un email será enviado inmediatamente al autor del proyecto con el informe de inviabilidad."
|
not_feasible_alert: "Un email será enviado inmediatamente al autor del proyecto con el informe de inviabilidad."
|
||||||
duration_html: Plazo de ejecución <small>(opcional, dato no público)</small>
|
duration_html: Plazo de ejecución <small>(opcional, dato no público)</small>
|
||||||
internal_comments_html: Comentarios y observaciones <small>(para responsables internos, dato no público)</small>
|
|
||||||
save: Guardar Cambios
|
save: Guardar Cambios
|
||||||
notice:
|
notice:
|
||||||
valuate: "Dossier actualizado"
|
valuate: "Dossier actualizado"
|
||||||
|
|||||||
12
lib/tasks/investments.rake
Normal file
12
lib/tasks/investments.rake
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
namespace :investments do
|
||||||
|
namespace :internal_comments do
|
||||||
|
desc "Migrate internal_comments textarea to a first comment on internal thread"
|
||||||
|
task migrate_to_thread: :environment do
|
||||||
|
comments_author_id = Administrator.first.user.id
|
||||||
|
Budget::Investment.where.not(internal_comments: [nil, '']).find_each do |investment|
|
||||||
|
Comment.create(commentable: investment, user_id: comments_author_id,
|
||||||
|
body: investment.internal_comments, valuation: true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -234,7 +234,6 @@ feature 'Valuation budget investments' do
|
|||||||
within('#duration') { expect(page).to have_content('Undefined') }
|
within('#duration') { expect(page).to have_content('Undefined') }
|
||||||
within('#feasibility') { expect(page).to have_content('Undecided') }
|
within('#feasibility') { expect(page).to have_content('Undecided') }
|
||||||
expect(page).not_to have_content('Valuation finished')
|
expect(page).not_to have_content('Valuation finished')
|
||||||
expect(page).not_to have_content('Internal comments')
|
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'Edit dossier' do
|
scenario 'Edit dossier' do
|
||||||
@@ -248,7 +247,6 @@ feature 'Valuation budget investments' do
|
|||||||
fill_in 'budget_investment_price_explanation', with: 'Very cheap idea'
|
fill_in 'budget_investment_price_explanation', with: 'Very cheap idea'
|
||||||
choose 'budget_investment_feasibility_feasible'
|
choose 'budget_investment_feasibility_feasible'
|
||||||
fill_in 'budget_investment_duration', with: '19 months'
|
fill_in 'budget_investment_duration', with: '19 months'
|
||||||
fill_in 'budget_investment_internal_comments', with: 'Should be double checked by the urbanism area'
|
|
||||||
click_button 'Save changes'
|
click_button 'Save changes'
|
||||||
|
|
||||||
expect(page).to have_content "Dossier updated"
|
expect(page).to have_content "Dossier updated"
|
||||||
@@ -262,8 +260,6 @@ feature 'Valuation budget investments' do
|
|||||||
within('#duration') { expect(page).to have_content('19 months') }
|
within('#duration') { expect(page).to have_content('19 months') }
|
||||||
within('#feasibility') { expect(page).to have_content('Feasible') }
|
within('#feasibility') { expect(page).to have_content('Feasible') }
|
||||||
expect(page).not_to have_content('Valuation finished')
|
expect(page).not_to have_content('Valuation finished')
|
||||||
expect(page).to have_content('Internal comments')
|
|
||||||
expect(page).to have_content('Should be double checked by the urbanism area')
|
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario 'Feasibility can be marked as pending' do
|
scenario 'Feasibility can be marked as pending' do
|
||||||
@@ -289,7 +285,7 @@ feature 'Valuation budget investments' do
|
|||||||
scenario 'Feasibility selection makes proper fields visible', :js do
|
scenario 'Feasibility selection makes proper fields visible', :js do
|
||||||
feasible_fields = ['Price (€)', 'Cost during the first year (€)', 'Price explanation', 'Time scope']
|
feasible_fields = ['Price (€)', 'Cost during the first year (€)', 'Price explanation', 'Time scope']
|
||||||
unfeasible_fields = ['Feasibility explanation']
|
unfeasible_fields = ['Feasibility explanation']
|
||||||
any_feasibility_fields = ['Valuation finished', 'Internal comments']
|
any_feasibility_fields = ['Valuation finished']
|
||||||
undecided_fields = feasible_fields + unfeasible_fields + any_feasibility_fields
|
undecided_fields = feasible_fields + unfeasible_fields + any_feasibility_fields
|
||||||
|
|
||||||
visit edit_valuation_budget_budget_investment_path(@budget, @investment)
|
visit edit_valuation_budget_budget_investment_path(@budget, @investment)
|
||||||
|
|||||||
Reference in New Issue
Block a user