Skip to content

Commit f5f5e01

Browse files
committed
Merge branch 'main' into add-filters-to-distribution-by-county
2 parents 4ab623e + 604088d commit f5f5e01

20 files changed

Lines changed: 331 additions & 132 deletions

Gemfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ group :development, :test do
160160
# More concise test ("should") matchers
161161
gem "shoulda-matchers", "~> 7.0"
162162
# Default rules for Rubocop.
163-
gem "standard", "~> 1.52"
163+
gem "standard", "~> 1.54"
164164
gem "standard-rails"
165165
gem "standard-performance"
166166
# Erb linter.
@@ -181,7 +181,7 @@ group :development do
181181
# Open sent e-mails in the browser instead of trying to send to a real mail server.
182182
gem "letter_opener"
183183
# Used as a dependency for Guard.
184-
gem "listen", "~> 3.9.0"
184+
gem "listen", "~> 3.10.0"
185185
# Generate a diagram based on Rails models.
186186
gem "rails-erd"
187187
# Allows to create a console in the browser.

Gemfile.lock

Lines changed: 37 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -84,20 +84,20 @@ GEM
8484
execjs (~> 2)
8585
awesome_print (1.9.2)
8686
aws-eventstream (1.4.0)
87-
aws-partitions (1.1187.0)
88-
aws-sdk-core (3.239.1)
87+
aws-partitions (1.1233.0)
88+
aws-sdk-core (3.244.0)
8989
aws-eventstream (~> 1, >= 1.3.0)
9090
aws-partitions (~> 1, >= 1.992.0)
9191
aws-sigv4 (~> 1.9)
9292
base64
9393
bigdecimal
9494
jmespath (~> 1, >= 1.6.1)
9595
logger
96-
aws-sdk-kms (1.118.0)
97-
aws-sdk-core (~> 3, >= 3.239.1)
96+
aws-sdk-kms (1.123.0)
97+
aws-sdk-core (~> 3, >= 3.244.0)
9898
aws-sigv4 (~> 1.5)
99-
aws-sdk-s3 (1.205.0)
100-
aws-sdk-core (~> 3, >= 3.234.0)
99+
aws-sdk-s3 (1.218.0)
100+
aws-sdk-core (~> 3, >= 3.244.0)
101101
aws-sdk-kms (~> 1)
102102
aws-sigv4 (~> 1.5)
103103
aws-sigv4 (1.12.1)
@@ -124,9 +124,9 @@ GEM
124124
erubi (~> 1.4)
125125
parser (>= 2.4)
126126
smart_properties
127-
bigdecimal (4.0.1)
127+
bigdecimal (4.1.1)
128128
bindex (0.8.1)
129-
binding_of_caller (1.0.1)
129+
binding_of_caller (2.0.0)
130130
debug_inspector (>= 1.2.0)
131131
bootsnap (1.20.1)
132132
msgpack (~> 1.2)
@@ -244,7 +244,7 @@ GEM
244244
factory_bot_rails (6.5.1)
245245
factory_bot (~> 6.5)
246246
railties (>= 6.1.0)
247-
faker (3.6.0)
247+
faker (3.6.1)
248248
i18n (>= 1.8.11, < 2)
249249
faraday (1.10.5)
250250
faraday-em_http (~> 1.0)
@@ -277,10 +277,9 @@ GEM
277277
concurrent-ruby (~> 1.1)
278278
webrick (~> 1.7)
279279
websocket-driver (~> 0.7)
280-
ffi (1.17.2)
281-
ffi (1.17.2-arm64-darwin)
282-
ffi (1.17.2-x86_64-darwin)
283-
ffi (1.17.2-x86_64-linux-gnu)
280+
ffi (1.17.4-arm64-darwin)
281+
ffi (1.17.4-x86_64-darwin)
282+
ffi (1.17.4-x86_64-linux-gnu)
284283
filterrific (5.2.7)
285284
flipper (1.4.0)
286285
concurrent-ruby (< 2)
@@ -343,7 +342,7 @@ GEM
343342
actionview (>= 7.0.0)
344343
activesupport (>= 7.0.0)
345344
jmespath (1.6.2)
346-
json (2.18.0)
345+
json (2.19.3)
347346
jwt (3.1.2)
348347
base64
349348
kaminari (1.2.2)
@@ -358,7 +357,8 @@ GEM
358357
activerecord
359358
kaminari-core (= 1.2.2)
360359
kaminari-core (1.2.2)
361-
knapsack_pro (9.2.1)
360+
knapsack_pro (9.2.3)
361+
logger
362362
rake
363363
language_server-protocol (3.17.0.5)
364364
launchy (3.0.0)
@@ -367,7 +367,8 @@ GEM
367367
letter_opener (1.10.0)
368368
launchy (>= 2.2, < 4)
369369
lint_roller (1.1.0)
370-
listen (3.9.0)
370+
listen (3.10.0)
371+
logger
371372
rb-fsevent (~> 0.10, >= 0.10.3)
372373
rb-inotify (~> 0.9, >= 0.9.10)
373374
logger (1.7.0)
@@ -376,7 +377,7 @@ GEM
376377
activesupport (>= 4)
377378
railties (>= 4)
378379
request_store (~> 1.0)
379-
loofah (2.25.0)
380+
loofah (2.25.1)
380381
crass (~> 1.0.2)
381382
nokogiri (>= 1.12.0)
382383
lumberjack (1.2.9)
@@ -397,7 +398,7 @@ GEM
397398
memory_profiler (1.1.0)
398399
method_source (1.1.0)
399400
mini_mime (1.1.5)
400-
minitest (6.0.2)
401+
minitest (6.0.3)
401402
drb (~> 2.0)
402403
prism (~> 1.5)
403404
monetize (2.0.0)
@@ -428,7 +429,8 @@ GEM
428429
timeout
429430
net-smtp (0.5.1)
430431
net-protocol
431-
newrelic_rpm (9.24.0)
432+
newrelic_rpm (10.2.0)
433+
logger
432434
nio4r (2.7.5)
433435
nokogiri (1.19.0-arm64-darwin)
434436
racc (~> 1.4)
@@ -471,7 +473,7 @@ GEM
471473
activerecord (>= 7.1)
472474
request_store (~> 1.4)
473475
parallel (1.27.0)
474-
parser (3.3.10.0)
476+
parser (3.3.11.1)
475477
ast (~> 2.4.1)
476478
racc
477479
pdf-core (0.9.0)
@@ -512,8 +514,8 @@ GEM
512514
pry-remote (0.1.8)
513515
pry (~> 0.9)
514516
slop (~> 3.0)
515-
pry-stack_explorer (0.6.1)
516-
binding_of_caller (~> 1.0)
517+
pry-stack_explorer (0.6.3)
518+
binding_of_caller (>= 1.0)
517519
pry (~> 0.13)
518520
psych (5.3.1)
519521
date
@@ -577,7 +579,7 @@ GEM
577579
rainbow (3.1.1)
578580
rake (13.3.1)
579581
rb-fsevent (0.11.2)
580-
rb-inotify (0.10.1)
582+
rb-inotify (0.11.1)
581583
ffi (~> 1.0)
582584
rdoc (7.2.0)
583585
erb
@@ -616,18 +618,18 @@ GEM
616618
rspec-mocks (~> 3.13)
617619
rspec-support (~> 3.13)
618620
rspec-support (3.13.6)
619-
rubocop (1.81.7)
621+
rubocop (1.84.2)
620622
json (~> 2.3)
621623
language_server-protocol (~> 3.17.0.2)
622624
lint_roller (~> 1.1.0)
623625
parallel (~> 1.10)
624626
parser (>= 3.3.0.2)
625627
rainbow (>= 2.2.2, < 4.0)
626628
regexp_parser (>= 2.9.3, < 3.0)
627-
rubocop-ast (>= 1.47.1, < 2.0)
629+
rubocop-ast (>= 1.49.0, < 2.0)
628630
ruby-progressbar (~> 1.7)
629631
unicode-display_width (>= 2.4.0, < 4.0)
630-
rubocop-ast (1.49.0)
632+
rubocop-ast (1.49.1)
631633
parser (>= 3.3.7.2)
632634
prism (~> 1.7)
633635
rubocop-performance (1.26.1)
@@ -696,10 +698,10 @@ GEM
696698
activesupport (>= 5.2)
697699
sprockets (>= 3.0.0)
698700
stackprof (0.2.27)
699-
standard (1.52.0)
701+
standard (1.54.0)
700702
language_server-protocol (~> 3.17.0.2)
701703
lint_roller (~> 1.0)
702-
rubocop (~> 1.81.7)
704+
rubocop (~> 1.84.0)
703705
standard-custom (~> 1.0.0)
704706
standard-performance (~> 1.8)
705707
standard-custom (1.0.2)
@@ -714,16 +716,16 @@ GEM
714716
stimulus-rails (1.3.4)
715717
railties (>= 6.0.0)
716718
stringio (3.2.0)
717-
strong_migrations (2.5.0)
718-
activerecord (>= 7.1)
719-
terser (1.2.6)
719+
strong_migrations (2.6.0)
720+
activerecord (>= 7.2)
721+
terser (1.2.7)
720722
execjs (>= 0.3.0, < 3)
721723
thor (1.5.0)
722724
tilt (2.2.0)
723-
timeout (0.4.4)
725+
timeout (0.6.1)
724726
tsort (0.2.0)
725727
ttfunk (1.7.0)
726-
turbo-rails (2.0.17)
728+
turbo-rails (2.0.23)
727729
actionpack (>= 7.1.0)
728730
railties (>= 7.1.0)
729731
tzinfo (2.0.6)
@@ -804,7 +806,7 @@ DEPENDENCIES
804806
kaminari
805807
knapsack_pro
806808
letter_opener
807-
listen (~> 3.9.0)
809+
listen (~> 3.10.0)
808810
lograge
809811
magic_test
810812
matrix
@@ -844,7 +846,7 @@ DEPENDENCIES
844846
solid_cache (~> 1.0)
845847
sprockets (~> 4.2.2)
846848
stackprof
847-
standard (~> 1.52)
849+
standard (~> 1.54)
848850
standard-performance
849851
standard-rails
850852
stimulus-rails

app/controllers/broadcast_announcements_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ def destroy
4545
private
4646

4747
def set_broadcast_announcement
48-
@broadcast_announcement = BroadcastAnnouncement.find(params[:id])
48+
@broadcast_announcement = BroadcastAnnouncement.where(organization_id: current_organization.id).find(params[:id])
4949
end
5050

5151
def broadcast_announcement_params

app/controllers/distributions_controller.rb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class DistributionsController < ApplicationController
1414
skip_before_action :require_organization, only: %i(calendar)
1515

1616
def print
17-
@distribution = Distribution.find(params[:id])
17+
@distribution = current_organization.distributions.find(params[:id])
1818
respond_to do |format|
1919
format.any do
2020
pdf = DistributionPdf.new(current_organization, @distribution)
@@ -27,7 +27,8 @@ def print
2727
end
2828

2929
def destroy
30-
service = DistributionDestroyService.new(params[:id])
30+
distribution = current_organization.distributions.find(params[:id])
31+
service = DistributionDestroyService.new(distribution.id)
3132
result = service.call
3233

3334
if result.success?
@@ -169,7 +170,7 @@ def new
169170
end
170171

171172
def show
172-
@distribution = Distribution.includes(:storage_location, line_items: :item).find(params[:id])
173+
@distribution = current_organization.distributions.includes(:storage_location, line_items: :item).find(params[:id])
173174
@line_items = @distribution.line_items
174175

175176
@total_quantity = @distribution.total_quantity
@@ -180,7 +181,7 @@ def show
180181
end
181182

182183
def edit
183-
@distribution = Distribution.includes(:line_items).includes(:storage_location).find(params[:id])
184+
@distribution = current_organization.distributions.includes(:line_items).includes(:storage_location).find(params[:id])
184185
@distribution.initialize_request_items
185186
if (!@distribution.complete? && @distribution.future?) ||
186187
current_user.has_cached_role?(Role::ORG_ADMIN, current_organization)
@@ -203,7 +204,7 @@ def edit
203204
end
204205

205206
def update
206-
@distribution = Distribution.includes(:line_items).includes(:storage_location).find(params[:id])
207+
@distribution = current_organization.distributions.includes(:line_items).includes(:storage_location).find(params[:id])
207208
result = DistributionUpdateService.new(@distribution, distribution_params).call
208209

209210
if result.success?

app/controllers/donations_controller.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ class DonationsController < ApplicationController
33
before_action :authorize_admin, only: [:destroy]
44

55
def print
6-
@donation = Donation.find(params[:id])
6+
@donation = current_organization.donations.find(params[:id])
77
respond_to do |format|
88
format.any do
99
pdf = DonationPdf.new(current_organization, @donation)
@@ -53,7 +53,7 @@ def new
5353
end
5454

5555
def edit
56-
@donation = Donation.find(params[:id])
56+
@donation = current_organization.donations.find(params[:id])
5757
@donation.line_items.build
5858
@changes_disallowed = SnapshotEvent.intervening(@donation).present?
5959
@audit_performed_and_finalized = Audit.finalized_since?(@donation, @donation.storage_location_id) &&
@@ -63,12 +63,12 @@ def edit
6363
end
6464

6565
def show
66-
@donation = Donation.includes(line_items: :item).find(params[:id])
66+
@donation = current_organization.donations.includes(line_items: :item).find(params[:id])
6767
@line_items = @donation.line_items
6868
end
6969

7070
def update
71-
@donation = Donation.find(params[:id])
71+
@donation = current_organization.donations.find(params[:id])
7272
@original_source = @donation.source
7373
ItemizableUpdateService.call(itemizable: @donation,
7474
params: donation_params,

app/controllers/kits_controller.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ def create
4444
end
4545

4646
def deactivate
47-
@kit = Kit.find(params[:id])
47+
@kit = current_organization.kits.find(params[:id])
4848
@kit.deactivate
4949
redirect_back(fallback_location: dashboard_path, notice: "Kit has been deactivated!")
5050
end
5151

5252
def reactivate
53-
@kit = Kit.find(params[:id])
53+
@kit = current_organization.kits.find(params[:id])
5454
if @kit.can_reactivate?
5555
@kit.reactivate
5656
redirect_back(fallback_location: dashboard_path, notice: "Kit has been reactivated!")
@@ -60,15 +60,15 @@ def reactivate
6060
end
6161

6262
def allocations
63-
@kit = Kit.find(params[:id])
63+
@kit = current_organization.kits.find(params[:id])
6464
@storage_locations = current_organization.storage_locations.active
6565
@inventory = View::Inventory.new(current_organization.id)
6666

6767
load_form_collections
6868
end
6969

7070
def allocate
71-
@kit = Kit.find(params[:id])
71+
@kit = current_organization.kits.find(params[:id])
7272
@storage_location = current_organization.storage_locations.active.find(kit_adjustment_params[:storage_location_id])
7373
@change_by = kit_adjustment_params[:change_by].to_i
7474
begin

app/controllers/requests_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def index
2828
end
2929

3030
def show
31-
@request = Request.find(params[:id])
31+
@request = current_organization.requests.find(params[:id])
3232
@item_requests = @request.item_requests.includes(:item)
3333

3434
@inventory = View::Inventory.new(@request.organization_id)
@@ -42,7 +42,7 @@ def show
4242
# and will move the user to the new distribution page with a
4343
# pre-filled distribution containing all the requested items.
4444
def start
45-
request = Request.find(params[:id])
45+
request = current_organization.requests.find(params[:id])
4646
begin
4747
request.status_started!
4848
flash[:notice] = "Request started"

app/models/concerns/issued_at.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def issued_at_cannot_be_before_2000
2121
end
2222

2323
def issued_at_cannot_be_further_than_1_year
24-
if issued_at.present? && issued_at > DateTime.now.next_year
24+
if issued_at.present? && issued_at > DateTime.current.next_year
2525
errors.add(:issued_at, "cannot be more than 1 year in the future")
2626
end
2727
end

0 commit comments

Comments
 (0)