Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure unique units are used when creating a request [#4579] #4835

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Clean out some lint [#4579]
awwaiid committed Dec 8, 2024
commit bfe4512403f7b2919e514e8f8f4740a5d4f61cd9
2 changes: 1 addition & 1 deletion app/services/partners/request_create_service.rb
Original file line number Diff line number Diff line change
@@ -66,7 +66,7 @@ def populate_item_request(partner_request)
pre_existing_entry = items[input_item['item_id']]
if pre_existing_entry
if pre_existing_entry.request_unit != input_item['request_unit']
errors.add(:base, "Please use the same unit for every #{Item.find(input_item['item_id']).name}")
errors.add(:base, "Please use the same unit for every #{Item.find(input_item["item_id"]).name}")
next
end
pre_existing_entry.quantity = (pre_existing_entry.quantity.to_i + input_item['quantity'].to_i).to_s
4 changes: 2 additions & 2 deletions spec/requests/partners/requests_spec.rb
Original file line number Diff line number Diff line change
@@ -209,7 +209,7 @@
item_id: item2.id,
request_unit: 'box',
quantity: 17
},
}
}
}
}
@@ -238,7 +238,7 @@
item_id: item1.id,
request_unit: 'box',
quantity: 17
},
}
}
}
}