From ab0617b03f9be1c27175bf756693a033241458d1 Mon Sep 17 00:00:00 2001 From: "A. Wilcox" Date: Fri, 6 Feb 2026 12:25:27 -0600 Subject: [PATCH] app: Split Alma item set env dropdowns This makes the production and sandbox dropdown elements completely separate. This should resolve the issue where the sandbox element sometimes overrides the production element, causing the wrong item set to be written to. Closes: AP-560 --- app/controllers/alma_item_set_controller.rb | 5 ++++- app/views/alma_item_set/index.html.erb | 20 ++++++++++++++------ 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/app/controllers/alma_item_set_controller.rb b/app/controllers/alma_item_set_controller.rb index 33c4fb10..4eba2ddf 100644 --- a/app/controllers/alma_item_set_controller.rb +++ b/app/controllers/alma_item_set_controller.rb @@ -1,6 +1,7 @@ require 'date' class AlmaItemSetController < ApplicationController + VALID_ENVS = %w[production sandbox].freeze # TODO: - Need to make sure only certain staff access this page before_action :authorize! @@ -14,7 +15,9 @@ def index # rubocop:disable Metrics/AbcSize def update env = params[:alma_env] - alma_set_id = params[:alma_set_id] + return head(:bad_request) unless env.in? VALID_ENVS + + alma_set_id = params[:"alma_set_id_#{env}"] num = params[:note_num] note = new_note(params[:note_value], params[:initials]) diff --git a/app/views/alma_item_set/index.html.erb b/app/views/alma_item_set/index.html.erb index 16b24144..21513f63 100644 --- a/app/views/alma_item_set/index.html.erb +++ b/app/views/alma_item_set/index.html.erb @@ -17,13 +17,21 @@ <%= f.label("#{rb_alma_env}_sandbox".to_sym, "Sandbox") %> <%# Set Name %> -
- <%= label_tag(:alma_set_id, 'Alma Set Name:', class: 'control-label') %> +
+
+ <%= label_tag(:alma_set_id_production, 'Production Alma Set Name:', class: 'control-label') %> +
+
+ <%= f.select(:alma_set_id_production, @production_sets, {}, {:class => 'form-control'}) %> +
-
- <%# f.text_field(:alma_set_name, class: 'narrow form-control add-required', aria: { required: true }, required: true, autofocus: true) %> - <%= f.select(:alma_set_id, @production_sets, {}, {:class => 'form-control', :id => 'prod-drop-down'}) %> - <%= f.select(:alma_set_id, @sandbox_sets, {}, {:class => 'form-control', :id => 'sand-drop-down'}) %> +
+
+ <%= label_tag(:alma_set_id_sandbox, 'Sandbox Alma Set Name:', class: 'control-label') %> +
+
+ <%= f.select(:alma_set_id_sandbox, @sandbox_sets, {}, {:class => 'form-control'}) %> +
<%# Note Number %>