Delete valuation

This commit is contained in:
voodoorai2000
2019-03-19 10:59:20 +01:00
parent a932737881
commit 24dde9c35e
28 changed files with 10 additions and 782 deletions

View File

@@ -49,7 +49,6 @@
//= require forms
//= require tracks
//= require valuation_budget_investment_form
//= require valuation_spending_proposal_form
//= require embed_video
//= require fixed_bar
//= require banners
@@ -105,7 +104,6 @@ var initialize_modules = function() {
App.Forms.initialize();
App.Tracks.initialize();
App.ValuationBudgetInvestmentForm.initialize();
App.ValuationSpendingProposalForm.initialize();
App.EmbedVideo.initialize();
App.FixedBar.initialize();
App.Banners.initialize();

View File

@@ -1,32 +0,0 @@
App.ValuationSpendingProposalForm =
showFeasibleFields: ->
$("#valuation_spending_proposal_edit_form #not_feasible_fields").hide("down")
$("#valuation_spending_proposal_edit_form #feasible_fields").show()
showNotFeasibleFields: ->
$("#valuation_spending_proposal_edit_form #feasible_fields").hide("down")
$("#valuation_spending_proposal_edit_form #not_feasible_fields").show()
showAllFields: ->
$("#valuation_spending_proposal_edit_form #feasible_fields").show("down")
$("#valuation_spending_proposal_edit_form #not_feasible_fields").show("down")
showFeasibilityFields: ->
feasible = $("#valuation_spending_proposal_edit_form input[type=radio][name='spending_proposal[feasible]']:checked").val()
if feasible == "true"
App.ValuationSpendingProposalForm.showFeasibleFields()
else if feasible == "false"
App.ValuationSpendingProposalForm.showNotFeasibleFields()
showFeasibilityFieldsOnChange: ->
$("#valuation_spending_proposal_edit_form input[type=radio][name='spending_proposal[feasible]']").change ->
App.ValuationSpendingProposalForm.showAllFields()
App.ValuationSpendingProposalForm.showFeasibilityFields()
initialize: ->
App.ValuationSpendingProposalForm.showFeasibilityFields()
App.ValuationSpendingProposalForm.showFeasibilityFieldsOnChange()
false

View File

@@ -43,10 +43,6 @@ class Admin::ValuatorsController < Admin::BaseController
redirect_to admin_valuators_path
end
def summary
@valuators = Valuator.order(spending_proposals_count: :desc)
end
private
def valuator_params

View File

@@ -1,85 +0,0 @@
class Valuation::SpendingProposalsController < Valuation::BaseController
include FeatureFlags
feature_flag :spending_proposals
before_action :restrict_access_to_assigned_items, only: [:show, :edit, :valuate]
has_filters %w{valuating valuation_finished}, only: :index
load_and_authorize_resource
def index
@geozone_filters = geozone_filters
@spending_proposals = if current_user.valuator?
SpendingProposal.scoped_filter(params_for_current_valuator, @current_filter)
.order(cached_votes_up: :desc)
.page(params[:page])
else
SpendingProposal.none.page(params[:page])
end
end
def valuate
if valid_price_params? && @spending_proposal.update(valuation_params)
if @spending_proposal.unfeasible_email_pending?
@spending_proposal.send_unfeasible_email
end
redirect_to valuation_spending_proposal_path(@spending_proposal), notice: t("valuation.spending_proposals.notice.valuate")
else
render action: :edit
end
end
private
def geozone_filters
spending_proposals = SpendingProposal.by_valuator(current_user.valuator.try(:id)).valuation_open.all.to_a
[ { name: t("valuation.spending_proposals.index.geozone_filter_all"),
id: nil,
pending_count: spending_proposals.size
},
{ name: t("geozones.none"),
id: "all",
pending_count: spending_proposals.count{|x| x.geozone_id.nil?}
}
] + Geozone.all.order(name: :asc).collect do |g|
{ name: g.name,
id: g.id,
pending_count: spending_proposals.count{|x| x.geozone_id == g.id}
}
end.select{ |x| x[:pending_count] > 0 }
end
def valuation_params
params[:spending_proposal][:feasible] = nil if params[:spending_proposal][:feasible] == "nil"
params.require(:spending_proposal).permit(:price, :price_first_year, :price_explanation, :feasible, :feasible_explanation,
:time_scope, :valuation_finished, :internal_comments)
end
def params_for_current_valuator
params.merge(valuator_id: current_user.valuator.id)
end
def restrict_access_to_assigned_items
return if current_user.administrator? ||
ValuationAssignment.exists?(spending_proposal_id: params[:id], valuator_id: current_user.valuator.id)
raise ActionController::RoutingError.new("Not Found")
end
def valid_price_params?
if /\D/.match params[:spending_proposal][:price]
@spending_proposal.errors.add(:price, I18n.t("spending_proposals.wrong_price_format"))
end
if /\D/.match params[:spending_proposal][:price_first_year]
@spending_proposal.errors.add(:price_first_year, I18n.t("spending_proposals.wrong_price_format"))
end
@spending_proposal.errors.empty?
end
end

View File

@@ -59,7 +59,6 @@ module Abilities
can :manage, Dashboard::Action
can [:read, :update, :valuate, :destroy, :summary], SpendingProposal
can [:index, :read, :new, :create, :update, :destroy, :calculate_winners], Budget
can [:read, :create, :update, :destroy], Budget::Group
can [:read, :create, :update, :destroy], Budget::Heading

View File

@@ -5,7 +5,6 @@ module Abilities
def initialize(user)
valuator = user.valuator
can [:read, :update, :valuate], SpendingProposal
can [:read, :update, :comment_valuation], Budget::Investment, id: valuator.assigned_investment_ids
can [:valuate], Budget::Investment, { id: valuator.assigned_investment_ids, valuation_finished: false }
cannot [:update, :valuate, :comment_valuation], Budget::Investment, budget: { phase: "finished" }

View File

@@ -1,4 +0,0 @@
class ValuationAssignment < ApplicationRecord
belongs_to :valuator, counter_cache: :spending_proposals_count
belongs_to :spending_proposal, counter_cache: true
end

View File

@@ -4,8 +4,6 @@ class Valuator < ApplicationRecord
delegate :name, :email, :name_and_email, to: :user
has_many :valuation_assignments, dependent: :destroy
has_many :spending_proposals, through: :valuation_assignments
has_many :valuator_assignments, dependent: :destroy, class_name: "Budget::ValuatorAssignment"
has_many :investments, through: :valuator_assignments, class_name: "Budget::Investment"

View File

@@ -1,9 +0,0 @@
<ul>
<% @spending_proposal.valuators.each do |valuator| %>
<li><%= valuator.name %> (<%= valuator.email %>)</li>
<% end %>
<% if @spending_proposal.valuators.empty? %>
<li><%= t("admin.spending_proposals.show.undefined") %></li>
<% end %>
</ul>

View File

@@ -1,75 +0,0 @@
<%= link_to admin_spending_proposal_path(@spending_proposal, @filter_params.to_h), class: 'back' do %>
<span class="icon-angle-left"></span> <%= t("admin.spending_proposals.show.back") %>
<% end %>
<%= form_for @spending_proposal,
url: admin_spending_proposal_path(@spending_proposal) do |f| %>
<% @filter_params.to_h.each do |filter_name, filter_value| %>
<%= hidden_field_tag filter_name, filter_value %>
<% end %>
<div class="row">
<div class="small-12 column">
<%= f.text_field :title, maxlength: SpendingProposal.title_max_length %>
</div>
<div class="ckeditor small-12 column">
<%= f.cktext_area :description,
maxlength: SpendingProposal.description_max_length,
ckeditor: { language: I18n.locale } %>
</div>
<div class="small-12 column">
<%= f.text_field :external_url %>
</div>
<div class="small-12 column">
<%= f.select :geozone_id, geozone_select_options, include_blank: t("geozones.none") %>
</div>
<div class="small-12 column">
<%= f.text_field :association_name, placeholder: t("spending_proposals.form.association_name") %>
</div>
</div>
<h2 id="classification"><%= t("admin.spending_proposals.edit.classification") %></h2>
<div class="row">
<div class="small-12 column">
<%= f.select(:administrator_id,
@admins.collect{ |a| [a.name_and_email, a.id ] },
{ include_blank: t("admin.spending_proposals.edit.undefined") }) %>
</div>
<div class="small-12 column">
<%= f.label :tag_list, t("admin.spending_proposals.edit.tags") %>
<div class="tags">
<% @tags.each do |tag| %>
<a class="js-add-tag-link"><%= tag.name %></a>
<% end %>
</div>
<%= f.text_field :tag_list, value: @spending_proposal.tag_list.to_s,
label: false,
placeholder: t("admin.spending_proposals.edit.tags_placeholder"),
class: "js-tag-list" %>
</div>
<div class="small-12 column">
<%= f.label :valuator_ids, t("admin.spending_proposals.edit.assigned_valuators") %>
<%= f.collection_check_boxes :valuator_ids, @valuators, :id, :email do |b| %>
<%= b.label(title: valuator_label(b.object)) { b.check_box + truncate(b.object.description_or_email, length: 60) } %>
<% end %>
</div>
</div>
<p class="clear">
<%= f.submit(class: "button", value: t("admin.spending_proposals.edit.submit_button")) %>
</p>
<% end %>
<hr>
<%= render "valuation/spending_proposals/written_by_valuators" %>

View File

@@ -1,50 +0,0 @@
<%= link_to admin_spending_proposals_path(@filter_params.to_h), data: {no_turbolink: true} do %>
<span class="icon-angle-left"></span> <%= t("admin.spending_proposals.show.back") %>
<% end %>
<%= render "written_by_author" %>
<%= link_to t("admin.spending_proposals.show.edit"),
edit_admin_spending_proposal_path(@spending_proposal,
@filter_params.to_h) %>
<hr>
<h2 id="classification"><%= t("admin.spending_proposals.show.classification") %></h2>
<p><strong><%= t("admin.spending_proposals.show.assigned_admin") %>:</strong>
<%= @spending_proposal.administrator.try(:name_and_email) || t("admin.spending_proposals.show.undefined") %>
</p>
<p id="tags">
<strong><%= t("admin.spending_proposals.show.tags") %>:</strong>
<%= @spending_proposal.tags.pluck(:name).join(", ") %>
</p>
<p id="assigned_valuators">
<strong><%= t("admin.spending_proposals.show.assigned_valuators") %>:</strong>
<% if @spending_proposal.valuators.any? %>
<%= @spending_proposal.valuators.collect(&:name_and_email).join(", ") %>
<% else %>
<%= t("admin.spending_proposals.show.undefined") %>
<% end %>
</p>
<p>
<%= link_to t("admin.spending_proposals.show.edit_classification"),
edit_admin_spending_proposal_path(@spending_proposal,
{anchor: 'classification'}.merge(@filter_params.to_h)) %>
</p>
<hr>
<h2><%= t("admin.spending_proposals.show.dossier") %></h2>
<%= render "valuation/spending_proposals/written_by_valuators" %>
<p>
<%= link_to t("admin.spending_proposals.show.edit_dossier"),
edit_valuation_spending_proposal_path(@spending_proposal) %>
</p>

View File

@@ -1,18 +0,0 @@
<%= link_to admin_spending_proposals_path, class: "back" do %>
<span class="icon-angle-left"></span>
<%= t("shared.back") %>
<% end %>
<h2><%= t("admin.spending_proposals.summary.title") %></h2>
<div id="all-proposals">
<%= render "summary_table",
spending_proposals: @spending_proposals,
second_scope: "all" %>
</div>
<div id="proposals-with-votes">
<h2><%= t("admin.spending_proposals.summary.title_proposals_with_supports") %></h2>
<%= render "summary_table",
spending_proposals: @spending_proposals_with_supports,
second_scope: "with_supports" %>
</div>

View File

@@ -1,39 +0,0 @@
<%= back_link_to %>
<h2><%= t("admin.valuators.summary.title") %></h2>
<table id="spending_proposals" class="investment-projects-summary">
<th><%= t("admin.valuators.summary.valuator_name") %></th>
<th><%= t("admin.valuators.summary.finished_and_feasible_count") %></th>
<th><%= t("admin.valuators.summary.finished_and_unfeasible_count") %></th>
<th><%= t("admin.valuators.summary.finished_count") %></th>
<th><%= t("admin.valuators.summary.in_evaluation_count") %></th>
<th><%= t("admin.valuators.summary.total_count") %></th>
<th><%= t("admin.valuators.summary.cost") %></th>
<% @valuators.each do |valuator| %>
<tr id="<%= dom_id(valuator) %>">
<td class="name">
<%= valuator.description_or_email %>
</td>
<td class="finished-and-feasible-count">
<%= valuator.spending_proposals.finished_and_feasible.count %>
</td>
<td class="finished-and-unfeasible-count">
<%= valuator.spending_proposals.finished_and_unfeasible.count %>
</td>
<td class="finished-count">
<%= valuator.spending_proposals.valuation_finished.count %>
</td>
<td class="in-evaluation-count">
<%= valuator.spending_proposals.valuating.count %>
</td>
<td class="total-count">
<%= valuator.spending_proposals.count %>
</td>
<td class="total-price text-center">
<%= number_to_currency(valuator.spending_proposals.sum(:price)) %>
</td>
</tr>
<% end %>
</table>

View File

@@ -4,15 +4,6 @@
<%= link_to t("valuation.menu.title"), valuation_root_path %>
</li>
<% if feature?(:spending_proposals) %>
<li <%= "class=is-active" if controller_name == "spending_proposals" %>>
<%= link_to valuation_spending_proposals_path do %>
<span class="icon-budget"></span>
<%= t("valuation.menu.spending_proposals") %>
<% end %>
</li>
<% end %>
<% if feature?(:budgets) %>
<li <%= "class=is-active" if controller_name == "budget_investments" %>>
<%= link_to valuation_budgets_path do %>

View File

@@ -1,53 +0,0 @@
<p id="price">
<strong>
<%= t("valuation.spending_proposals.show.price") %>
(<%= t("valuation.spending_proposals.show.currency") %>):
</strong>
<% if @spending_proposal.price.present? %>
<%= @spending_proposal.price %>
<% else %>
<%= t("valuation.spending_proposals.show.undefined") %>
<% end %>
</p>
<p id="price_first_year">
<strong>
<%= t("valuation.spending_proposals.show.price_first_year") %>
(<%= t("valuation.spending_proposals.show.currency") %>):
</strong>
<% if @spending_proposal.price_first_year.present? %>
<%= @spending_proposal.price_first_year %>
<% else %>
<%= t("valuation.spending_proposals.show.undefined") %>
<% end %>
</p>
<%= explanation_field @spending_proposal.price_explanation %>
<p id="time_scope">
<strong><%= t("valuation.spending_proposals.show.time_scope") %>:</strong>
<% if @spending_proposal.time_scope.present? %>
<%= @spending_proposal.time_scope %>
<% else %>
<%= t("valuation.spending_proposals.show.undefined") %>
<% end %>
</p>
<p id="feasibility">
<strong><%= t("valuation.spending_proposals.show.feasibility") %>:</strong>
<%= t("valuation.spending_proposals.show.#{@spending_proposal.feasibility}") %>
</p>
<%= explanation_field @spending_proposal.feasible_explanation %>
<% if @spending_proposal.valuation_finished %>
<p id="valuation">
<strong><%= t("valuation.spending_proposals.show.valuation_finished") %></strong>
</p>
<% end %>
<% if @spending_proposal.internal_comments.present? %>
<h2><%= t("valuation.spending_proposals.show.internal_comments") %></h2>
<%= explanation_field @spending_proposal.internal_comments %>
<% end %>

View File

@@ -1,147 +0,0 @@
<%= link_to "#{t("valuation.spending_proposals.show.heading")} #{@spending_proposal.id}", valuation_spending_proposal_path(@spending_proposal), class: "back" %>
<h2><%= t("valuation.spending_proposals.edit.dossier") %></h2>
<%= form_for(@spending_proposal, url: valuate_valuation_spending_proposal_path(@spending_proposal), html: {id: "valuation_spending_proposal_edit_form"}) do |f| %>
<%= render "shared/errors", resource: @spending_proposal %>
<div class="row">
<div class="small-12 medium-8 column">
<fieldset class="fieldset">
<legend><%= t("valuation.spending_proposals.edit.feasibility") %></legend>
<div class="small-4 column">
<span class="radio">
<%= f.radio_button :feasible, :nil, label: false, checked: @spending_proposal.feasible.nil? %>
<%= f.label :feasible_nil, t("valuation.spending_proposals.edit.undefined_feasible") %>
</span>
</div>
<div class="small-4 column">
<span class="radio">
<%= f.radio_button :feasible, true, value: true, label: false %>
<%= f.label :feasible_true, t("valuation.spending_proposals.edit.feasible") %>
</span>
</div>
<div class="small-4 column">
<span class="radio">
<%= f.radio_button :feasible, false, value: false, label: false %>
<%= f.label :feasible_false, t("valuation.spending_proposals.edit.not_feasible") %>
</span>
</div>
</fieldset>
</div>
</div>
<div id="not_feasible_fields" >
<div class="row">
<div class="small-12 medium-8 column">
<%= f.label :feasible_explanation, t("valuation.spending_proposals.edit.feasible_explanation_html") %>
<%= f.text_area :feasible_explanation, label: false, rows: 3 %>
</div>
</div>
</div>
<div id="feasible_fields">
<div class="row">
<div class="small-12 medium-4 column">
<%= f.label :price, "#{t("valuation.spending_proposals.edit.price_html", currency: t("valuation.spending_proposals.edit.currency"))}" %>
<%= f.number_field :price, label: false, max: 1000000000000000 %>
</div>
<div class="small-12 medium-4 column end">
<%= f.label :price_first_year, "#{t("valuation.spending_proposals.edit.price_first_year_html", currency: t("valuation.spending_proposals.edit.currency"))}" %>
<%= f.number_field :price_first_year, label: false, max: 1000000000000000 %>
</div>
</div>
<div class="row">
<div class="small-12 medium-8 column">
<%= f.label :price_explanation, t("valuation.spending_proposals.edit.price_explanation_html") %>
<%= f.text_area :price_explanation, label: false, rows: 3 %>
</div>
</div>
<div class="row">
<div class="small-12 medium-8 column">
<%= f.label :time_scope, t("valuation.spending_proposals.edit.time_scope_html") %>
<%= f.text_field :time_scope, label: false %>
</div>
</div>
</div>
<div class="row">
<div class="small-12 medium-8 column">
<%= f.label :valuation_finished do %>
<%= f.check_box :valuation_finished, title: t("valuation.spending_proposals.edit.valuation_finished"), label: false %>
<span class="checkbox"><%= t("valuation.spending_proposals.edit.valuation_finished") %></span>
<% end %>
</div>
</div>
<div class="row">
<div class="small-12 medium-8 column">
<%= f.label :internal_comments, t("valuation.spending_proposals.edit.internal_comments_html") %>
<%= f.text_area :internal_comments, label: false, rows: 3 %>
</div>
</div>
<div class="row">
<div class="actions small-12 medium-4 column">
<%= f.submit(class: "button expanded large", value: t("valuation.spending_proposals.edit.save")) %>
</div>
</div>
<% end %>
<h1><%= @spending_proposal.title %></h1>
<%= safe_html_with_links @spending_proposal.description %>
<% if @spending_proposal.external_url.present? %>
<p><%= text_with_links @spending_proposal.external_url %></p>
<% end %>
<h2><%= t("valuation.spending_proposals.show.info") %></h2>
<p><strong><%= t("valuation.spending_proposals.show.by") %>:</strong>
<%= link_to @spending_proposal.author.name, user_path(@spending_proposal.author) %>
</p>
<% if @spending_proposal.association_name.present? %>
<p><strong><%= t("valuation.spending_proposals.show.association_name") %>:</strong>
<%= @spending_proposal.association_name %>
</p>
<% end %>
<p><strong><%= t("valuation.spending_proposals.show.geozone") %>:</strong>
<%= geozone_name(@spending_proposal) %>
</p>
<p><strong><%= t("valuation.spending_proposals.show.sent") %>:</strong>
<%= l @spending_proposal.created_at, format: :datetime %>
</p>
<h2><%= t("valuation.spending_proposals.show.responsibles") %></h2>
<p><strong><%= t("valuation.spending_proposals.show.assigned_admin") %>:</strong>
<% if @spending_proposal.administrator.present? %>
<%= @spending_proposal.administrator.name %> (<%= @spending_proposal.administrator.email %>)
<% else %>
<%= t("valuation.spending_proposals.show.undefined") %>
<% end %>
</p>
<p><strong><%= t("valuation.spending_proposals.show.assigned_valuators") %>:</strong></p>
<div id="assigned_valuators">
<ul>
<% @spending_proposal.valuators.each do |valuator| %>
<li><%= valuator.name %> (<%= valuator.email %>)</li>
<% end %>
<% if @spending_proposal.valuators.empty? %>
<li><%= t("valuation.spending_proposals.show.undefined") %></li>
<% end %>
</ul>
</div>

View File

@@ -1,42 +0,0 @@
<h2><%= t("valuation.spending_proposals.index.title") %></h2>
<div class="row collapse">
<% @geozone_filters.each_slice(8) do |slice| %>
<div class="small-12 medium-4 column select-geozone">
<% slice.each do |filter| %>
<%= link_to valuation_spending_proposals_path(geozone_id: filter[:id]),
class: "#{"is-active" if params[:geozone_id].to_s == filter[:id].to_s}" do %>
<%= filter[:name] %>&nbsp;(<%= filter[:pending_count] %>)
<% end %>
<% end %>
</div>
<% end %>
</div>
<%= render "shared/filter_subnav", i18n_namespace: "valuation.spending_proposals.index" %>
<h3><%= page_entries_info @spending_proposals %></h3>
<table>
<% @spending_proposals.each do |spending_proposal| %>
<tr id="<%= dom_id(spending_proposal) %>">
<td>
<strong><%= spending_proposal.id %></strong>
</td>
<td>
<%= link_to spending_proposal.title, valuation_spending_proposal_path(spending_proposal) %>
</td>
<td class="small">
<%= link_to t("valuation.spending_proposals.index.edit"), edit_valuation_spending_proposal_path(spending_proposal) %>
</td>
<td class="small">
<%= assigned_valuators_info(spending_proposal.valuators) %>
</td>
<td class="small">
<%= geozone_name(spending_proposal) %>
</td>
</tr>
<% end %>
</table>
<%= paginate @spending_proposals %>

View File

@@ -1,61 +0,0 @@
<%= back_link_to %>
<h2><%= t("valuation.spending_proposals.show.heading") %> <%= @spending_proposal.id %> </h2>
<h1><%= @spending_proposal.title %></h1>
<%= safe_html_with_links @spending_proposal.description %>
<% if @spending_proposal.external_url.present? %>
<p><%= text_with_links @spending_proposal.external_url %></p>
<% end %>
<h2><%= t("valuation.spending_proposals.show.info") %></h2>
<p><strong><%= t("valuation.spending_proposals.show.by") %>:</strong>
<%= link_to @spending_proposal.author.name, user_path(@spending_proposal.author) %>
</p>
<% if @spending_proposal.association_name.present? %>
<p><strong><%= t("valuation.spending_proposals.show.association_name") %>:</strong>
<%= @spending_proposal.association_name %>
</p>
<% end %>
<p><strong><%= t("valuation.spending_proposals.show.geozone") %>:</strong>
<%= geozone_name(@spending_proposal) %>
</p>
<p><strong><%= t("valuation.spending_proposals.show.sent") %>:</strong>
<%= l @spending_proposal.created_at, format: :datetime %>
</p>
<h2><%= t("valuation.spending_proposals.show.responsibles") %></h2>
<p><strong><%= t("valuation.spending_proposals.show.assigned_admin") %>:</strong>
<% if @spending_proposal.administrator.present? %>
<%= @spending_proposal.administrator.name_and_email %>
<% else %>
<%= t("valuation.spending_proposals.show.undefined") %>
<% end %>
</p>
<p><strong><%= t("valuation.spending_proposals.show.assigned_valuators") %>:</strong></p>
<div id="assigned_valuators">
<ul>
<% @spending_proposal.valuators.each do |valuator| %>
<li><%= valuator.name_and_email %></li>
<% end %>
<% if @spending_proposal.valuators.empty? %>
<li><%= t("valuation.spending_proposals.show.undefined") %></li>
<% end %>
</ul>
</div>
<h2><%= t("valuation.spending_proposals.show.dossier") %></h2>
<p>
<%= link_to t("valuation.spending_proposals.show.edit_dossier"), edit_valuation_spending_proposal_path(@spending_proposal) %>
</p>
<%= render "written_by_valuators" %>

View File

@@ -168,7 +168,6 @@ ignore_unused:
- "moderation.budget_investments.index.order*"
- "moderation.proposal_notifications.index.filter*"
- "moderation.proposal_notifications.index.order*"
- "valuation.spending_proposals.index.filter*"
- "valuation.budgets.index.filter*"
- "valuation.budget_investments.index.filter*"
- "users.show.filters.*"

View File

@@ -715,7 +715,6 @@ en:
content_block:
update: "Update Block"
title_moderated_content: Moderated content
title_budgets: Budgets
title_profiles: Profiles
title_settings: Settings
title_site_customization: Site content
@@ -906,15 +905,6 @@ en:
delete: Delete
search:
title: "Valuators: User search"
summary:
title: Valuator summary for investment projects
valuator_name: Valuator
finished_and_feasible_count: Finished and feasible
finished_and_unfeasible_count: Finished and unfeasible
finished_count: Finished
in_evaluation_count: In evaluation
total_count: Total
cost: Cost
form:
edit_title: "Valuators: Edit valuator"
update: "Update valuator"
@@ -1378,16 +1368,6 @@ en:
tags: Tags
tags_placeholder: "Write the tags you want separated by commas (,)"
undefined: Undefined
summary:
title: Summary for investment projects
title_proposals_with_supports: Summary for investment projects with supports
geozone_name: Scope
finished_and_feasible_count: Finished and feasible
finished_and_unfeasible_count: Finished and unfeasible
finished_count: Finished
in_evaluation_count: In evaluation
total_count: Total
cost_for_geozone: Cost
geozones:
index:
title: Geozone

View File

@@ -5,7 +5,6 @@ en:
menu:
title: Valuation
budgets: Participatory budgets
spending_proposals: Spending proposals
budgets:
index:
title: Participatory budgets
@@ -77,52 +76,3 @@ en:
valuate: "Dossier updated"
valuation_comments: Valuation comments
not_in_valuating_phase: Investments can only be valuated when Budget is in valuating phase
spending_proposals:
index:
geozone_filter_all: All zones
filters:
valuation_open: Open
valuating: Under valuation
valuation_finished: Valuation finished
title: Investment projects for participatory budgeting
edit: Edit
show:
back: Back
heading: Investment project
info: Author info
association_name: Association
by: Sent by
sent: Sent at
geozone: Scope
dossier: Dossier
edit_dossier: Edit dossier
price: Price
price_first_year: Cost during the first year
currency: "€"
feasibility: Feasibility
feasible: Feasible
not_feasible: Not feasible
undefined: Undefined
valuation_finished: Valuation finished
time_scope: Time scope
internal_comments: Internal comments
responsibles: Responsibles
assigned_admin: Assigned admin
assigned_valuators: Assigned valuators
edit:
dossier: Dossier
price_html: "Price (%{currency})"
price_first_year_html: "Cost during the first year (%{currency})"
currency: "€"
price_explanation_html: Price explanation
feasibility: Feasibility
feasible: Feasible
not_feasible: Not feasible
undefined_feasible: Pending
feasible_explanation_html: Feasibility explanation
valuation_finished: Valuation finished
time_scope_html: Time scope
internal_comments_html: Internal comments
save: Save changes
notice:
valuate: "Dossier updated"

View File

@@ -905,15 +905,6 @@ es:
delete: Borrar
search:
title: "Evaluadores: Búsqueda de usuarios"
summary:
title: Resumen de evaluación de proyectos de gasto
valuator_name: Evaluador
finished_and_feasible_count: Finalizadas viables
finished_and_unfeasible_count: Finalizadas inviables
finished_count: Finalizadas
in_evaluation_count: En evaluación
total_count: Total
cost: Coste total
form:
edit_title: "Evaluadores: Editar evaluador"
update: "Actualizar evaluador"

View File

@@ -5,7 +5,6 @@ es:
menu:
title: Evaluación
budgets: Presupuestos participativos
spending_proposals: Propuestas de inversión
budgets:
index:
title: Presupuestos participativos
@@ -77,52 +76,3 @@ es:
valuate: "Dossier actualizado"
valuation_comments: Comentarios de evaluación
not_in_valuating_phase: Los proyectos sólo pueden ser evaluados cuando el Presupuesto esté en fase de evaluación
spending_proposals:
index:
geozone_filter_all: Todos los ámbitos de actuación
filters:
valuation_open: Abiertas
valuating: En evaluación
valuation_finished: Evaluación finalizada
title: Propuestas de inversión para presupuestos participativos
edit: Editar
show:
back: Volver
heading: Propuesta de inversión
info: Datos de envío
association_name: Asociación
by: Enviada por
sent: Fecha de creación
geozone: Ámbito de actuación
dossier: Informe
edit_dossier: Editar informe
price: Coste
price_first_year: Coste en el primer año
currency: "€"
feasibility: Viabilidad
feasible: Viable
not_feasible: No viable
undefined: Sin definir
valuation_finished: Informe finalizado
time_scope: Plazo de ejecución
internal_comments: Comentarios internos
responsibles: Responsables
assigned_admin: Administrador asignado
assigned_valuators: Evaluadores asignados
edit:
dossier: Informe
price_html: "Coste (%{currency}) <small>(dato público)</small>"
price_first_year_html: "Coste en el primer año (%{currency}) <small>(opcional, privado)</small>"
currency: "€"
price_explanation_html: Informe de coste <small>(opcional, dato público)</small>
feasibility: Viabilidad
feasible: Viable
not_feasible: Inviable
undefined_feasible: Sin decidir
feasible_explanation_html: Informe de inviabilidad <small>(en caso de que lo sea, dato público)</small>
valuation_finished: Informe finalizado
time_scope_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
notice:
valuate: "Informe actualizado"

View File

@@ -1,10 +1,6 @@
namespace :valuation do
root to: "budgets#index"
resources :spending_proposals, only: [:index, :show, :edit] do
patch :valuate, on: :member
end
resources :budgets, only: :index do
resources :budget_investments, only: [:index, :show, :edit] do
patch :valuate, on: :member

View File

@@ -22,9 +22,3 @@ section "Creating Spending Proposals" do
terms_of_service: "1")
end
end
section "Creating Valuation Assignments" do
(1..17).to_a.sample.times do
SpendingProposal.all.sample.valuators << Valuator.first
end
end

View File

@@ -0,0 +1,5 @@
class DestroySpendingProposalValuations < ActiveRecord::Migration
def change
drop_table :valuation_assignments
end
end

View File

@@ -67,11 +67,6 @@ describe Abilities::Administrator do
it { should be_able_to(:comment_as_administrator, legislation_question) }
it { should_not be_able_to(:comment_as_moderator, legislation_question) }
it { should be_able_to(:read, SpendingProposal) }
it { should be_able_to(:update, SpendingProposal) }
it { should be_able_to(:valuate, SpendingProposal) }
it { should be_able_to(:destroy, SpendingProposal) }
it { should be_able_to(:create, Budget) }
it { should be_able_to(:update, Budget) }
it { should be_able_to(:read_results, Budget) }

View File

@@ -21,9 +21,11 @@ describe Abilities::Valuator do
finished_assigned_investment.valuators << valuator
end
it { should be_able_to(:read, SpendingProposal) }
it { should be_able_to(:update, SpendingProposal) }
it { should be_able_to(:valuate, SpendingProposal) }
it "cannot valuate an assigned investment with a finished valuation" do
assigned_investment.update(valuation_finished: true)
should_not be_able_to(:valuate, assigned_investment)
end
it "cannot valuate an assigned investment with a finished valuation" do
assigned_investment.update(valuation_finished: true)