Skip to content

Commit 8992173

Browse files
authored
Merge branch 'main' into dependabot/bundler/turbo-rails-2.0.11
2 parents 2de1bbf + 36f4fe8 commit 8992173

File tree

429 files changed

+6059
-4578
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

429 files changed

+6059
-4578
lines changed
File renamed without changes.

.rubocop_todo.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,6 @@ Layout/SpaceInsideHashLiteralBraces:
225225
- 'app/models/product_drive_participant.rb'
226226
- 'app/models/distribution.rb'
227227
- 'app/models/donation.rb'
228-
- 'app/models/inventory_item.rb'
229228
- 'app/models/item.rb'
230229
- 'app/models/item_category.rb'
231230
- 'app/models/kit.rb'

CONTRIBUTING.md

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,20 +53,49 @@ Make sure to install **Ubuntu** as your Linux distribution. (This should be defa
5353
<details>
5454
<summary> Bank Users 🏦 </summary>
5555

56+
Pawnee Diaper Bank
57+
A fully set up bank with items, storage locations, donations, distributions, requests, etc.
58+
The bank has multiple partners associated with it.
5659
```
5760
Organization Admin
58-
61+
5962
Password: password!
6063
6164
User
6265
6366
Password: password!
6467
```
68+
69+
Second City Essentials Bank
70+
A fully set up bank with items, storage locations, donations, distributions, requests, etc.
71+
The bank has four items unique to it (named Second City Item #).
72+
```
73+
Organization Admin
74+
75+
Password: password!
76+
77+
User
78+
79+
Password: password!
80+
```
81+
82+
SF Diaper Bank
83+
A bank which has just been accepted and so is not fully set up. It lacks many of the records the other banks have.
84+
```
85+
Organization Admin
86+
87+
Password: password!
88+
89+
User
90+
91+
Password: password!
92+
```
6593
</details>
6694

6795
<details>
6896
<summary> Partner Users 👥 </summary>
6997

98+
Partners in Pawnee Diaper Bank partner groups
7099
```
71100
Verified Partner
72101
@@ -87,10 +116,17 @@ Make sure to install **Ubuntu** as your Linux distribution. (This should be defa
87116
Waiting Approval Partner
88117
89118
Password: password!
90-
91-
Another approved partner (with all groups):
119+
120+
Another verified partner (in second partner group):
92121
93-
Pasword: password!
122+
Password: password!
123+
```
124+
125+
Partners in Second City Essentials Bank partner group
126+
```
127+
Verified partner
128+
129+
Password: password!
94130
```
95131
</details>
96132

@@ -221,7 +257,7 @@ Before submitting a pull request, run all tests and lints. Fix any broken tests
221257
- Once your first PR has been merged, all commits pushed to an open PR will also run these workflows.
222258
223259
#### Local testing
224-
- Run all lints with `bin/lint`.
260+
- Run all lints with `bin/lint`. (You can lint a single file/folder with `bin/lint {path_to_folder_or_file}`.)
225261
- Run all tests with `bundle exec rspec`
226262
- You can run a single test with `bundle exec rspec {path_to_test_name}_spec.rb` or on a specific line by appending `:LineNumber`
227263
- If you need to skip a failing test, place `pending("Reason you are skipping the test")` into the `it` block rather than skipping with `xit`. This will allow rspec to deliver the error message without causing the test suite to fail.

Gemfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ gem "jwt"
100100
gem "newrelic_rpm"
101101
# Used to manage periodic cron-like jobs
102102
gem "clockwork"
103+
# Speed up app boot time by caching expensive operations
104+
gem 'bootsnap', require: false
103105

104106
##### DEPENDENCY PINS ######
105107
# These are gems that aren't used directly, only as dependencies for other gems.

Gemfile.lock

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ GEM
111111
bindex (0.8.1)
112112
binding_of_caller (1.0.1)
113113
debug_inspector (>= 1.2.0)
114+
bootsnap (1.18.4)
115+
msgpack (~> 1.2)
114116
bootstrap (5.2.3)
115117
autoprefixer-rails (>= 9.1.0)
116118
popper_js (>= 2.11.6, < 3)
@@ -120,7 +122,7 @@ GEM
120122
bugsnag (6.27.1)
121123
concurrent-ruby (~> 1.0)
122124
builder (3.3.0)
123-
bullet (7.2.0)
125+
bullet (8.0.0)
124126
activesupport (>= 3.0.0)
125127
uniform_notifier (~> 1.11)
126128
capybara (3.40.0)
@@ -143,7 +145,7 @@ GEM
143145
coderay (1.1.3)
144146
concurrent-ruby (1.3.4)
145147
connection_pool (2.4.1)
146-
coverband (6.1.2)
148+
coverband (6.1.4)
147149
redis (>= 3.0)
148150
crack (1.0.0)
149151
bigdecimal
@@ -259,11 +261,11 @@ GEM
259261
ffi (1.17.0-x86_64-darwin)
260262
ffi (1.17.0-x86_64-linux-gnu)
261263
filterrific (5.2.5)
262-
flipper (1.3.1)
264+
flipper (1.3.2)
263265
concurrent-ruby (< 2)
264-
flipper-active_record (1.3.0)
265-
activerecord (>= 4.2, < 8)
266-
flipper (~> 1.3.0)
266+
flipper-active_record (1.3.2)
267+
activerecord (>= 4.2, < 9)
268+
flipper (~> 1.3.2)
267269
flipper-ui (1.3.1)
268270
erubi (>= 1.0.0, < 2.0.0)
269271
flipper (~> 1.3.1)
@@ -373,7 +375,7 @@ GEM
373375
method_source (1.1.0)
374376
mini_magick (4.13.2)
375377
mini_mime (1.1.5)
376-
minitest (5.25.1)
378+
minitest (5.25.2)
377379
monetize (1.12.0)
378380
money (~> 6.12)
379381
money (6.16.0)
@@ -383,12 +385,13 @@ GEM
383385
monetize (~> 1.9)
384386
money (~> 6.13)
385387
railties (>= 3.0)
388+
msgpack (1.7.5)
386389
multi_xml (0.7.1)
387390
bigdecimal (~> 3.1)
388391
multipart-post (2.4.1)
389392
mustermann (3.0.0)
390393
ruby2_keywords (~> 0.0.1)
391-
mutex_m (0.2.0)
394+
mutex_m (0.3.0)
392395
nenv (0.3.0)
393396
net-http-persistent (4.0.2)
394397
connection_pool (~> 2.2)
@@ -401,7 +404,7 @@ GEM
401404
timeout
402405
net-smtp (0.5.0)
403406
net-protocol
404-
newrelic_rpm (9.13.0)
407+
newrelic_rpm (9.16.0)
405408
nio4r (2.7.3)
406409
nokogiri (1.16.7-arm64-darwin)
407410
racc (~> 1.4)
@@ -671,7 +674,7 @@ GEM
671674
execjs (>= 0.3.0, < 3)
672675
thor (1.3.2)
673676
tilt (2.2.0)
674-
timeout (0.4.1)
677+
timeout (0.4.2)
675678
ttfunk (1.7.0)
676679
turbo-rails (2.0.11)
677680
actionpack (>= 6.0.0)
@@ -706,6 +709,7 @@ PLATFORMS
706709
arm64-darwin-21
707710
arm64-darwin-22
708711
arm64-darwin-23
712+
arm64-darwin-24
709713
x86_64-darwin-20
710714
x86_64-darwin-21
711715
x86_64-darwin-22
@@ -718,6 +722,7 @@ DEPENDENCIES
718722
azure-storage-blob
719723
better_errors
720724
binding_of_caller
725+
bootsnap
721726
bootstrap (~> 5.2)
722727
brakeman
723728
bugsnag
@@ -800,4 +805,4 @@ DEPENDENCIES
800805
webmock (~> 3.24)
801806

802807
BUNDLED WITH
803-
2.5.22
808+
2.5.23

app/assets/stylesheets/custom.scss

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,13 @@
9898
margin-top: 40px;
9999
}
100100
}
101+
102+
.accordion-button.saving::after {
103+
background-image: none;
104+
content: "Saving...";
105+
font-size: 0.875rem;
106+
color: #005568;
107+
transform: none;
108+
width: 3rem;
109+
cursor: not-allowed;
110+
}

app/controllers/admin/base_items_controller.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# [Super Admin] Manage the BaseItems -- this is the only place in the app where Base Items can be
22
# added / modified. Base Items are both the template and common thread for regular Items
3+
#
4+
# See #4656, BaseItems are pending significant changes/possible deletion
35
class Admin::BaseItemsController < AdminController
46
def edit
57
@base_item = BaseItem.find(params[:id])
@@ -40,7 +42,9 @@ def show
4042

4143
def destroy
4244
@base_item = BaseItem.includes(:items).find(params[:id])
43-
if @base_item.items.any? && @base_item.destroy
45+
if @base_item.id == KitCreateService.find_or_create_kit_base_item!.id
46+
redirect_to admin_base_items_path, alert: "You cannot delete the Kits base item. This is reserved for all Kits."
47+
elsif @base_item.items.empty? && @base_item.destroy
4448
redirect_to admin_base_items_path, notice: "Base Item deleted!"
4549
else
4650
redirect_to admin_base_items_path, alert: "Failed to delete Base Item. Are there still items attached?"

app/controllers/admin/organizations_controller.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,14 @@ def new
4646

4747
def create
4848
@organization = Organization.new(organization_params)
49+
@user = User.new(user_params)
4950

5051
if @organization.save
5152
Organization.seed_items(@organization)
52-
@user = UserInviteService.invite(name: user_params[:name],
53-
email: user_params[:email],
54-
roles: [Role::ORG_USER, Role::ORG_ADMIN],
55-
resource: @organization)
53+
UserInviteService.invite(name: user_params[:name],
54+
email: user_params[:email],
55+
roles: [Role::ORG_USER, Role::ORG_ADMIN],
56+
resource: @organization)
5657
SnapshotEvent.publish(@organization) # need one to start with
5758
redirect_to admin_organizations_path, notice: "Organization added!"
5859
else

app/controllers/audits_controller.rb

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,7 @@ def index
1010
end
1111

1212
def show
13-
if Event.read_events?(@audit.organization)
14-
@items = View::Inventory.items_for_location(@audit.storage_location)
15-
else
16-
@inventory_items = @audit.storage_location.inventory_items
17-
end
13+
@items = View::Inventory.items_for_location(@audit.storage_location, include_omitted: true)
1814
end
1915

2016
def edit
@@ -28,24 +24,7 @@ def finalize
2824
@audit.adjustment = Adjustment.new(organization_id: @audit.organization_id, storage_location_id: @audit.storage_location_id, user_id: current_user.id, comment: 'Created Automatically through the Auditing Process')
2925
@audit.save
3026

31-
inventory_items = @audit.storage_location.inventory_items
32-
33-
inventory_items.each do |inventory_item|
34-
line_item = @audit.line_items.find_by(item: inventory_item.item)
35-
36-
next if line_item.nil?
37-
38-
if line_item.quantity != inventory_item.quantity
39-
@audit.adjustment.line_items.create(item_id: inventory_item.item.id, quantity: line_item.quantity - inventory_item.quantity)
40-
end
41-
end
42-
43-
increasing_adjustment, decreasing_adjustment = @audit.adjustment.split_difference
44-
ActiveRecord::Base.transaction do
45-
@audit.storage_location.increase_inventory(increasing_adjustment.line_item_values)
46-
@audit.storage_location.decrease_inventory(decreasing_adjustment.line_item_values)
47-
AuditEvent.publish(@audit)
48-
end
27+
AuditEvent.publish(@audit)
4928
@audit.finalized!
5029
redirect_to audit_path(@audit), notice: "Audit is Finalized."
5130
rescue => e
@@ -114,7 +93,7 @@ def set_storage_locations
11493
end
11594

11695
def set_items
117-
@items = current_organization.items.alphabetized
96+
@items = current_organization.items.where(active: true).alphabetized
11897
end
11998

12099
def save_audit_status_and_redirect(params)

0 commit comments

Comments
 (0)