Skip to content

Commit

Permalink
fix(#4134): inconsistent request behavior
Browse files Browse the repository at this point in the history
Fixes #4134

Individual requests and Quantity requests are very similar
but have small differences in behavior:
- Quantity requests allow comment only requests
- Quantity requests filter out blank lines

This PR will unify the behavior so both Individual and Quantity requests
will act like Quantity requests.
  • Loading branch information
elasticspoon committed Feb 29, 2024
1 parent 20c7212 commit 43ab7e2
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -751,4 +751,4 @@ DEPENDENCIES
webmock (~> 3.23)

BUNDLED WITH
2.5.4
2.5.6
3 changes: 2 additions & 1 deletion app/services/partners/family_request_create_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ def valid?
end

def item_requests_attributes
@item_requests_attributes ||= family_requests_attributes.map do |fr_attr|
@item_requests_attributes ||= family_requests_attributes.filter_map do |fr_attr|
next if fr_attr[:item_id].blank? && fr_attr[:person_count].blank?
{
item_id: fr_attr[:item_id],
quantity: convert_person_count_to_item_quantity(item_id: fr_attr[:item_id], person_count: fr_attr[:person_count])&.to_i,
Expand Down
5 changes: 3 additions & 2 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,8 @@
t.integer "organization_id"
t.datetime "issued_at", precision: nil
t.string "agency_rep"
t.integer "state", default: 5, null: false
t.boolean "reminder_email_enabled", default: false, null: false
t.integer "state", default: 5, null: false
t.integer "delivery_method", default: 0, null: false
t.decimal "shipping_cost", precision: 8, scale: 2
t.index ["organization_id"], name: "index_distributions_on_organization_id"
Expand Down Expand Up @@ -840,7 +840,8 @@
end

create_table "versions", force: :cascade do |t|
t.string "item_type", null: false
t.string "item_type"
t.string "{:null=>false}"
t.bigint "item_id", null: false
t.string "event", null: false
t.string "whodunnit"
Expand Down
4 changes: 2 additions & 2 deletions spec/system/partners/managing_requests_system_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
end
end

context 'WHEN they create a request inproperly' do
context 'WHEN they create a request completely empty request' do
before do
click_button 'Submit Essentials Request'
end
Expand Down Expand Up @@ -192,7 +192,7 @@
visit new_partners_request_path
end

context 'WHEN they create a request inproperly by not inputting anything' do
context 'WHEN they create a request completely empty request' do
before do
click_button 'Submit Essentials Request'
end
Expand Down

0 comments on commit 43ab7e2

Please sign in to comment.