From 0024a86d226322e809348a9408f1ffd295a03a17 Mon Sep 17 00:00:00 2001 From: Joaquin <20804419+joaquinco@users.noreply.github.com> Date: Fri, 28 Feb 2025 15:51:38 -0300 Subject: [PATCH 01/11] [NU-19] Add flag to remove synaccess rev a relay option (#5060) * Add flag to remove synaccess rev a relay option --- app/helpers/products_helper.rb | 14 +++++++++----- config/settings.yml | 1 + spec/helpers/products_helper_spec.rb | 27 +++++++++++++++++++++++++++ 3 files changed, 37 insertions(+), 5 deletions(-) create mode 100644 spec/helpers/products_helper_spec.rb diff --git a/app/helpers/products_helper.rb b/app/helpers/products_helper.rb index 5dce81c48e..ff1ed96b8d 100644 --- a/app/helpers/products_helper.rb +++ b/app/helpers/products_helper.rb @@ -20,11 +20,15 @@ def options_for_control_mechanism end def options_for_relay - { - RelaySynaccessRevA => RelaySynaccessRevA.name, - RelaySynaccessRevB => RelaySynaccessRevB.name, - RelayDataprobe => RelayDataprobe.name, - } + [ + if SettingsHelper.feature_on?(:disable_relay_synaccess_rev_a) + nil + else + [RelaySynaccessRevA, RelaySynaccessRevA.name] + end, + [RelaySynaccessRevB, RelaySynaccessRevB.name], + [RelayDataprobe, RelayDataprobe.name], + ].compact end def instrument_pricing_modes diff --git a/config/settings.yml b/config/settings.yml index 781b69fa5e..3996548ce6 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -162,6 +162,7 @@ feature: show_daily_rate_option: true sanger_enabled_service: <%= ENV.fetch("SANGER_ENABLED_SERVICE", false) %> well_plate_alternative_csv_format: <%= ENV.fetch("well_plate_alternative_csv_format", false) %> + disable_relay_synaccess_rev_a: false split_accounts: # Roles are allowed to create Split Accounts diff --git a/spec/helpers/products_helper_spec.rb b/spec/helpers/products_helper_spec.rb new file mode 100644 index 0000000000..b31bdd606c --- /dev/null +++ b/spec/helpers/products_helper_spec.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +require "rails_helper" + +RSpec.describe ProductsHelper do + describe "#options_for_relay" do + let(:subject) { options_for_relay } + + it( + "list all relay types if none disabled", + { feature_setting: { disable_relay_synaccess_rev_a: false } } + ) do + expect(subject.to_h).to include( + RelaySynaccessRevA, + RelaySynaccessRevB, + RelayDataprobe + ) + end + + it( + "exclude synaccess rev a if disabled flag is on", + { feature_setting: { disable_relay_synaccess_rev_a: true } } + ) do + expect(subject.to_h).to_not include(RelaySynaccessRevA) + end + end +end From 8f4a3dd091c964a65cd79750657f3502cba4f636 Mon Sep 17 00:00:00 2001 From: Leticia Errandonea Mattos Date: Wed, 5 Mar 2025 11:37:04 -0300 Subject: [PATCH 02/11] [UMASS-175] Allow Global Billing admins to update actual cost (#5062) * Allow Global Billing admins to update actual cost * Update permitted params --- .../order_details_controller.rb | 16 ++++++- app/services/order_details/param_updater.rb | 6 ++- .../order_details/_costs.html.haml | 2 +- config/settings.yml | 1 + spec/system/admin/manage_order_detail_spec.rb | 46 +++++++++++++++++++ 5 files changed, 67 insertions(+), 4 deletions(-) diff --git a/app/controllers/order_management/order_details_controller.rb b/app/controllers/order_management/order_details_controller.rb index 0698c7968a..e440abab2a 100644 --- a/app/controllers/order_management/order_details_controller.rb +++ b/app/controllers/order_management/order_details_controller.rb @@ -13,7 +13,7 @@ class OrderManagement::OrderDetailsController < ApplicationController # We can't load through the facility because of cross-core orders before_action :init_order_detail, only: [:files, :template_results] - helper_method :edit_disabled? + helper_method :edit_disabled?, :actual_cost_edit_disabled? before_action :authorize_order_detail, except: %i(sample_results) before_action :load_accounts, only: [:edit, :update] @@ -117,7 +117,19 @@ def load_order_statuses end def edit_disabled? - @order_detail.in_open_journal? || @order_detail.reconciled? + in_open_journal_or_reconciled = @order_detail.in_open_journal? || @order_detail.reconciled? + + if SettingsHelper.feature_on?(:allow_global_billing_admin_update_actual_prices) + in_open_journal_or_reconciled || (@order_detail.awaiting_payment? && !current_user.global_billing_administrator?) + else + in_open_journal_or_reconciled + end + end + + def actual_cost_edit_disabled? + return true unless SettingsHelper.feature_on?(:allow_global_billing_admin_update_actual_prices) + + @order_detail.awaiting_payment? && !current_user.global_billing_administrator? end def init_order_detail diff --git a/app/services/order_details/param_updater.rb b/app/services/order_details/param_updater.rb index fbc32b81b2..caf4efe763 100644 --- a/app/services/order_details/param_updater.rb +++ b/app/services/order_details/param_updater.rb @@ -106,7 +106,11 @@ def assign_price_changed_by_user end def cost_params(params) - params.slice(:actual_cost, :actual_subsidy).permit! + return params.slice(:actual_cost, :actual_subsidy).permit! unless SettingsHelper.feature_on?(:allow_global_billing_admin_update_actual_prices) + + if !@order_detail.awaiting_payment? || @editing_user.global_billing_administrator? + params.slice(:actual_cost, :actual_subsidy).permit! + end end def permitted_params(params) diff --git a/app/views/order_management/order_details/_costs.html.haml b/app/views/order_management/order_details/_costs.html.haml index a4e4e532fd..b3abdfe385 100644 --- a/app/views/order_management/order_details/_costs.html.haml +++ b/app/views/order_management/order_details/_costs.html.haml @@ -1,7 +1,7 @@ - f.object.send(:extend, PriceDisplayment) - if f.object.actual_cost? .cost-table - .cost= f.input :actual_cost, as: :currency + .cost= f.input :actual_cost, as: :currency, disabled: actual_cost_edit_disabled? .subsidy= f.input :actual_subsidy, as: :currency, disabled: !f.object.price_policy.try(:has_subsidy?), hint: "#{f.object.price_policy.try(:price_group)}" .total= f.input :actual_total, as: :currency, disabled: true - else diff --git a/config/settings.yml b/config/settings.yml index 3996548ce6..9bedb58ac5 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -163,6 +163,7 @@ feature: sanger_enabled_service: <%= ENV.fetch("SANGER_ENABLED_SERVICE", false) %> well_plate_alternative_csv_format: <%= ENV.fetch("well_plate_alternative_csv_format", false) %> disable_relay_synaccess_rev_a: false + allow_global_billing_admin_update_actual_prices: false split_accounts: # Roles are allowed to create Split Accounts diff --git a/spec/system/admin/manage_order_detail_spec.rb b/spec/system/admin/manage_order_detail_spec.rb index 5a702ba7b7..ac0a7bef46 100644 --- a/spec/system/admin/manage_order_detail_spec.rb +++ b/spec/system/admin/manage_order_detail_spec.rb @@ -363,4 +363,50 @@ end end end + + shared_examples "does not allow to update actual cost" do + it "does not allow to update actual cost" do + expect(page).to have_field("order_detail[actual_cost]", disabled: true) + end + end + + describe "updating actual cost" do + let(:statement) { create(:statement, facility:, created_by: 1) } + + before do + start_at = Time.zone.parse("#{Date.today} 10:00:00") - 1.day + end_at = start_at + 1.hour + + reservation.update!(actual_start_at: start_at, actual_end_at: end_at) + order_detail.update!(reviewed_at: 5.days.ago, statement:, actual_cost: 10) + + visit manage_facility_order_order_detail_path(facility, order, order_detail) + end + + context "with feature flag ON", feature_setting: { allow_global_billing_admin_update_actual_prices: true } do + context "as a global admin" do + it_behaves_like "does not allow to update actual cost" + end + + context "as a global billing admin" do + let(:logged_in_user) { create(:user, :global_billing_administrator) } + + it "allows to update actual cost" do + expect(page).to have_field("order_detail[actual_cost]", disabled: false) + end + end + end + + context "with feature flag OFF", feature_setting: { allow_global_billing_admin_update_actual_prices: false } do + context "as a global admin" do + it_behaves_like "does not allow to update actual cost" + end + + context "as a global billing admin" do + let(:logged_in_user) { create(:user, :global_billing_administrator) } + + it_behaves_like "does not allow to update actual cost" + end + end + end end From b2f9cfca8588957ea25d93d57042356ea40e8861 Mon Sep 17 00:00:00 2001 From: Joaquin <20804419+joaquinco@users.noreply.github.com> Date: Wed, 5 Mar 2025 12:12:03 -0300 Subject: [PATCH 03/11] Fix spec depending on synaccess rev a relay selection (#5070) --- spec/system/admin/instrument_relay_tab_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/system/admin/instrument_relay_tab_spec.rb b/spec/system/admin/instrument_relay_tab_spec.rb index 901a1992fe..d838c24d77 100644 --- a/spec/system/admin/instrument_relay_tab_spec.rb +++ b/spec/system/admin/instrument_relay_tab_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" -RSpec.describe "Instrument Relay Tab" do +RSpec.describe "Instrument Relay Tab", feature_setting: { disable_relay_synaccess_rev_a: false } do let(:facility) { FactoryBot.create(:setup_facility) } let(:user) { FactoryBot.create(:user, :administrator) } From 1f31c23621a3c3c60ac5569780456d075802b2e4 Mon Sep 17 00:00:00 2001 From: Joaquin <20804419+joaquinco@users.noreply.github.com> Date: Wed, 5 Mar 2025 15:29:25 -0300 Subject: [PATCH 04/11] [UMASS-175] Fix condition when ff on (#5071) * Fix condition when ff on * Fix specs --------- Co-authored-by: Leticia Errandonea --- .../order_details_controller.rb | 2 +- spec/system/admin/manage_order_detail_spec.rb | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/app/controllers/order_management/order_details_controller.rb b/app/controllers/order_management/order_details_controller.rb index e440abab2a..d196c86cb1 100644 --- a/app/controllers/order_management/order_details_controller.rb +++ b/app/controllers/order_management/order_details_controller.rb @@ -127,7 +127,7 @@ def edit_disabled? end def actual_cost_edit_disabled? - return true unless SettingsHelper.feature_on?(:allow_global_billing_admin_update_actual_prices) + return false unless SettingsHelper.feature_on?(:allow_global_billing_admin_update_actual_prices) @order_detail.awaiting_payment? && !current_user.global_billing_administrator? end diff --git a/spec/system/admin/manage_order_detail_spec.rb b/spec/system/admin/manage_order_detail_spec.rb index ac0a7bef46..0cccae36b2 100644 --- a/spec/system/admin/manage_order_detail_spec.rb +++ b/spec/system/admin/manage_order_detail_spec.rb @@ -364,9 +364,9 @@ end end - shared_examples "does not allow to update actual cost" do - it "does not allow to update actual cost" do - expect(page).to have_field("order_detail[actual_cost]", disabled: true) + shared_examples "allows to update actual cost" do + it "allows to update actual cost" do + expect(page).to have_field("order_detail[actual_cost]", disabled: false) end end @@ -385,27 +385,27 @@ context "with feature flag ON", feature_setting: { allow_global_billing_admin_update_actual_prices: true } do context "as a global admin" do - it_behaves_like "does not allow to update actual cost" + it "does not allow to update actual cost" do + expect(page).to have_field("order_detail[actual_cost]", disabled: true) + end end context "as a global billing admin" do let(:logged_in_user) { create(:user, :global_billing_administrator) } - it "allows to update actual cost" do - expect(page).to have_field("order_detail[actual_cost]", disabled: false) - end + it_behaves_like "allows to update actual cost" end end context "with feature flag OFF", feature_setting: { allow_global_billing_admin_update_actual_prices: false } do context "as a global admin" do - it_behaves_like "does not allow to update actual cost" + it_behaves_like "allows to update actual cost" end context "as a global billing admin" do let(:logged_in_user) { create(:user, :global_billing_administrator) } - it_behaves_like "does not allow to update actual cost" + it_behaves_like "allows to update actual cost" end end end From 39c78400402d77e6485b7dd18e4087b47ed07622 Mon Sep 17 00:00:00 2001 From: Leticia Errandonea Mattos Date: Wed, 5 Mar 2025 18:05:27 -0300 Subject: [PATCH 05/11] Handle missing case (#5072) --- app/services/order_details/param_updater.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/services/order_details/param_updater.rb b/app/services/order_details/param_updater.rb index caf4efe763..e14da68833 100644 --- a/app/services/order_details/param_updater.rb +++ b/app/services/order_details/param_updater.rb @@ -110,6 +110,8 @@ def cost_params(params) if !@order_detail.awaiting_payment? || @editing_user.global_billing_administrator? params.slice(:actual_cost, :actual_subsidy).permit! + else + {} end end From 9db2fec551238bd3d473a5cc27021d183a65a41b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 6 Mar 2025 09:24:44 -0300 Subject: [PATCH 06/11] Bump rubocop from 1.73.0 to 1.73.2 (#5065) Bumps [rubocop](https://github.com/rubocop/rubocop) from 1.73.0 to 1.73.2. - [Release notes](https://github.com/rubocop/rubocop/releases) - [Changelog](https://github.com/rubocop/rubocop/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop/rubocop/compare/v1.73.0...v1.73.2) --- updated-dependencies: - dependency-name: rubocop dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile | 2 +- Gemfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 1fe2fde746..ac31d89773 100644 --- a/Gemfile +++ b/Gemfile @@ -117,7 +117,7 @@ group :development do gem "ed25519", ">= 1.2", "< 2.0", require: false # Required to support ed25519 SSH keys for capistrano. https://github.com/net-ssh/net-ssh/issues/565 gem "haml_lint", require: false gem "letter_opener" - gem "rubocop", "1.73.0", require: false + gem "rubocop", "1.73.2", require: false gem "rubocop-performance" gem "rubocop-rails" gem "rubocop-rspec" diff --git a/Gemfile.lock b/Gemfile.lock index 92763ded8d..fc493a4201 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -560,7 +560,7 @@ GEM rspec-support (3.13.2) rspec_junit_formatter (0.6.0) rspec-core (>= 2, < 4, != 2.12.0) - rubocop (1.73.0) + rubocop (1.73.2) json (~> 2.3) language_server-protocol (~> 3.17.0.2) lint_roller (~> 1.1.0) @@ -789,7 +789,7 @@ DEPENDENCIES rspec-collection_matchers rspec-rails rspec_junit_formatter - rubocop (= 1.73.0) + rubocop (= 1.73.2) rubocop-performance rubocop-rails rubocop-rspec From 3d4f41548f41a6e487aab66e1054aa0671755889 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 6 Mar 2025 09:25:05 -0300 Subject: [PATCH 07/11] Bump rubocop-rails from 2.30.2 to 2.30.3 (#5066) Bumps [rubocop-rails](https://github.com/rubocop/rubocop-rails) from 2.30.2 to 2.30.3. - [Release notes](https://github.com/rubocop/rubocop-rails/releases) - [Changelog](https://github.com/rubocop/rubocop-rails/blob/master/CHANGELOG.md) - [Commits](https://github.com/rubocop/rubocop-rails/compare/v2.30.2...v2.30.3) --- updated-dependencies: - dependency-name: rubocop-rails dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index fc493a4201..e5076a7028 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -482,7 +482,7 @@ GEM puma (6.6.0) nio4r (~> 2.0) racc (1.8.1) - rack (2.2.11) + rack (2.2.12) rack-test (2.2.0) rack (>= 1.3) rack-utf8_sanitizer (1.10.1) @@ -577,7 +577,7 @@ GEM lint_roller (~> 1.1) rubocop (>= 1.72.1, < 2.0) rubocop-ast (>= 1.38.0, < 2.0) - rubocop-rails (2.30.2) + rubocop-rails (2.30.3) activesupport (>= 4.2.0) lint_roller (~> 1.1) rack (>= 1.1) From 087c3c00c0365b4d67cd3d60d3bec2c1ef104c2f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 6 Mar 2025 09:25:15 -0300 Subject: [PATCH 08/11] Bump aws-sdk-core from 3.219.0 to 3.220.0 (#5067) Bumps [aws-sdk-core](https://github.com/aws/aws-sdk-ruby) from 3.219.0 to 3.220.0. - [Release notes](https://github.com/aws/aws-sdk-ruby/releases) - [Changelog](https://github.com/aws/aws-sdk-ruby/blob/version-3/gems/aws-sdk-core/CHANGELOG.md) - [Commits](https://github.com/aws/aws-sdk-ruby/commits) --- updated-dependencies: - dependency-name: aws-sdk-core dependency-type: indirect update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index e5076a7028..c2b733b3b9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -138,8 +138,8 @@ GEM amazing_print (1.7.2) ast (2.4.2) aws-eventstream (1.3.1) - aws-partitions (1.1056.0) - aws-sdk-core (3.219.0) + aws-partitions (1.1060.0) + aws-sdk-core (3.220.0) aws-eventstream (~> 1, >= 1.3.0) aws-partitions (~> 1, >= 1.992.0) aws-sigv4 (~> 1.9) From f17352bdb2b5fc447eba37e19e5d0af42e46b6f6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 6 Mar 2025 09:25:28 -0300 Subject: [PATCH 09/11] Bump rack from 2.2.11 to 2.2.12 (#5068) Bumps [rack](https://github.com/rack/rack) from 2.2.11 to 2.2.12. - [Release notes](https://github.com/rack/rack/releases) - [Changelog](https://github.com/rack/rack/blob/main/CHANGELOG.md) - [Commits](https://github.com/rack/rack/compare/v2.2.11...v2.2.12) --- updated-dependencies: - dependency-name: rack dependency-type: indirect update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> From dd7331201a023d9326fbdd55f1eef7fe3ffdafbd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 6 Mar 2025 09:25:40 -0300 Subject: [PATCH 10/11] Bump mime-types-data from 3.2025.0220 to 3.2025.0304 (#5069) Bumps [mime-types-data](https://github.com/mime-types/mime-types-data) from 3.2025.0220 to 3.2025.0304. - [Changelog](https://github.com/mime-types/mime-types-data/blob/main/CHANGELOG.md) - [Commits](https://github.com/mime-types/mime-types-data/compare/v3.2025.0220...v3.2025.0304) --- updated-dependencies: - dependency-name: mime-types-data dependency-type: indirect update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index c2b733b3b9..a152ac02a1 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -401,7 +401,7 @@ GEM mime-types (3.6.0) logger mime-types-data (~> 3.2015) - mime-types-data (3.2025.0220) + mime-types-data (3.2025.0304) mini_magick (5.2.0) benchmark logger From ed4071460bffce2acb14b747fd4fc78df86cfaa0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 6 Mar 2025 09:27:12 -0300 Subject: [PATCH 11/11] Bump parallel_tests from 4.9.1 to 5.0.1 (#5073) Bumps [parallel_tests](https://github.com/grosser/parallel_tests) from 4.9.1 to 5.0.1. - [Changelog](https://github.com/grosser/parallel_tests/blob/master/CHANGELOG.md) - [Commits](https://github.com/grosser/parallel_tests/compare/v4.9.1...v5.0.1) --- updated-dependencies: - dependency-name: parallel_tests dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Gemfile.lock | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Gemfile.lock b/Gemfile.lock index a152ac02a1..37e55f393d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -451,7 +451,7 @@ GEM activerecord (>= 6.1) request_store (~> 1.4) parallel (1.26.3) - parallel_tests (4.9.1) + parallel_tests (5.0.1) parallel paranoia (3.0.1) activerecord (>= 6, < 8.1)