From 578efa945eea14936e95cc8349fc4533fe58c87e Mon Sep 17 00:00:00 2001 From: mariodz95 Date: Tue, 19 Oct 2021 10:26:44 +0200 Subject: [PATCH] Fix snail when editing enterprise fees --- app/controllers/admin/enterprise_fees_controller.rb | 7 +++++++ config/locales/en_US.yml | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/app/controllers/admin/enterprise_fees_controller.rb b/app/controllers/admin/enterprise_fees_controller.rb index 2b4852a613..ad17c5d90d 100644 --- a/app/controllers/admin/enterprise_fees_controller.rb +++ b/app/controllers/admin/enterprise_fees_controller.rb @@ -35,6 +35,13 @@ module Admin end def bulk_update + @flat_percent_value = enterprise_fee_bulk_params.dig('collection_attributes', '0', 'calculator_attributes', 'preferred_flat_percent') + + unless @flat_percent_value.nil? || Float(@flat_percent_value, exception: false) + flash[:error] = I18n.t(:calculator_preferred_value_error) + return redirect_to redirect_path + end + @enterprise_fee_set = Sets::EnterpriseFeeSet.new(enterprise_fee_bulk_params) if @enterprise_fee_set.save diff --git a/config/locales/en_US.yml b/config/locales/en_US.yml index d4c8ba8930..e8b96054c3 100644 --- a/config/locales/en_US.yml +++ b/config/locales/en_US.yml @@ -174,7 +174,7 @@ en_US: userguide: "Open Food Network User Guide" email_admin_html: "You can manage your account by logging into the %{link} or by clicking on the person shape in the top right hand side of the homepage, and selecting \"Administration\" from the dropdown." admin_panel: "Admin Panel" - email_community_html: "We'll leave you to explore the platform and our community (%{link}) for now and will check back in tomorrow with more information and resources! In the meantime, please make sure emails from addresses at openfoodnetwork.net aren't intercepted by your spam filter. Once again, welcome to our community, we're glad you are here!" + email_community_html: "We'll leave you to explore the platform and our community for now and will check back in soon with more information and resources! In the meantime, please make sure emails from addresses at openfoodnetwork.net aren't intercepted by your spam filter. If you have any questions at all, please don't hesitate to contact us at support-usa@openfoodnetwork.net. Once again, welcome to our community, we're glad you are here!" join_community: "Join the community" invite_manager: subject: "%{enterprise} has invited you to be a manager"