From b1a5a324c7c48c53919407c7a7aae80f159c7e4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juanjo=20Baza=CC=81n?= Date: Thu, 26 Jan 2017 13:15:43 +0100 Subject: [PATCH 1/3] adds missing checkbox label for unfeasible investments --- app/views/admin/shared/_budget_investment_search.html.erb | 1 + config/locales/admin.en.yml | 1 + config/locales/admin.es.yml | 1 + 3 files changed, 3 insertions(+) diff --git a/app/views/admin/shared/_budget_investment_search.html.erb b/app/views/admin/shared/_budget_investment_search.html.erb index 410044c10..f29a3a0d1 100644 --- a/app/views/admin/shared/_budget_investment_search.html.erb +++ b/app/views/admin/shared/_budget_investment_search.html.erb @@ -14,6 +14,7 @@
<%= check_box_tag :unfeasible, "1", params[:unfeasible].present? %> + <%= t("admin.budget_investments.search_unfeasible") %>
diff --git a/config/locales/admin.en.yml b/config/locales/admin.en.yml index dadcb7745..460319748 100755 --- a/config/locales/admin.en.yml +++ b/config/locales/admin.en.yml @@ -153,6 +153,7 @@ en: tags: Tags tags_placeholder: "Write the tags you want separated by commas (,)" undefined: Undefined + search_unfeasible: Search unfeasible comments: index: filter: Filter diff --git a/config/locales/admin.es.yml b/config/locales/admin.es.yml index 09959cfde..7d6438416 100644 --- a/config/locales/admin.es.yml +++ b/config/locales/admin.es.yml @@ -153,6 +153,7 @@ es: tags: Etiquetas tags_placeholder: "Escribe las etiquetas que desees separadas por comas (,)" undefined: Sin definir + search_unfeasible: Buscar inviables comments: index: filter: Filtro From e93461356cce9ee96f3a07593b13d3c0b8359573 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juanjo=20Baza=CC=81n?= Date: Tue, 7 Feb 2017 19:05:04 +0100 Subject: [PATCH 2/3] quotes random seed --- app/controllers/budgets/investments_controller.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/budgets/investments_controller.rb b/app/controllers/budgets/investments_controller.rb index ebf14d94b..36f9f5c6d 100644 --- a/app/controllers/budgets/investments_controller.rb +++ b/app/controllers/budgets/investments_controller.rb @@ -77,7 +77,8 @@ module Budgets def set_random_seed if params[:order] == 'random' || params[:order].blank? params[:random_seed] ||= rand(99)/100.0 - Budget::Investment.connection.execute "select setseed(#{params[:random_seed]})" + seed = Budget::Investment.connection.quote(params[:random_seed]) + Budget::Investment.connection.execute("select setseed(#{seed})") else params[:random_seed] = nil end From ba0b39a45cf579a5640f309f79b371075b2f97f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juanjo=20Baza=CC=81n?= Date: Tue, 7 Feb 2017 19:29:17 +0100 Subject: [PATCH 3/3] avoids error 500 if invalid random_seed --- app/controllers/budgets/investments_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/budgets/investments_controller.rb b/app/controllers/budgets/investments_controller.rb index 36f9f5c6d..0a5e78eef 100644 --- a/app/controllers/budgets/investments_controller.rb +++ b/app/controllers/budgets/investments_controller.rb @@ -77,7 +77,7 @@ module Budgets def set_random_seed if params[:order] == 'random' || params[:order].blank? params[:random_seed] ||= rand(99)/100.0 - seed = Budget::Investment.connection.quote(params[:random_seed]) + seed = Float(params[:random_seed]) rescue 0 Budget::Investment.connection.execute("select setseed(#{seed})") else params[:random_seed] = nil