Skip to content

Commit e651186

Browse files
committed
Remove redundant type_default variable
- `<%= select_tag(:action_type, options_for_select(action_type_arr, type_default)` was only being executed when `if condition.nil?` was true (now line 20). Additionally, that was the only line that was using the `type_default` variable. - Thus, no conditional is required for the assigning of `type_default` and we can just use `:remove` explicitly on line 30 now.
1 parent b2eaac4 commit e651186

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

app/views/org_admin/conditions/_form.html.erb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
action_type_arr = [["removes", :remove], ["adds notification", :add_webhook]]
1111
name_start = "conditions[#{condition_no.to_s}]"
1212
remove_question_collection = later_question_list(question)
13-
type_default = condition.present? ? (condition[:action_type] == "remove" ? :remove : :add_webhook) : :remove
1413
remove_question_group = condition.present? ?
1514
grouped_options_for_select(remove_question_collection, condition[:remove_question_id]) :
1615
grouped_options_for_select(remove_question_collection)
@@ -28,7 +27,7 @@
2827
</div>
2928
<div class="col-md-3 pe-2">
3029
<div class="form-label bold"><%= _('Action') %></div>
31-
<%= select_tag(:action_type, options_for_select(action_type_arr, type_default), {name: name_start + "[action_type]", class: 'action-type form-select narrow', 'data-bs-style': 'dropdown-toggle bg-white px-4 py-3'}) %>
30+
<%= select_tag(:action_type, options_for_select(action_type_arr, :remove), {name: name_start + "[action_type]", class: 'action-type form-select narrow', 'data-bs-style': 'dropdown-toggle bg-white px-4 py-3'}) %>
3231
</div>
3332
</div>
3433
<div class="row d-flex mb-3">

0 commit comments

Comments
 (0)