Skip to content

Commit 6ea3394

Browse files
authored
Merge branch 'main' into fix_request_fulfilled_issue
2 parents d2e58ea + 5d4ca69 commit 6ea3394

File tree

72 files changed

+2415
-257
lines changed

Some content is hidden

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

72 files changed

+2415
-257
lines changed

Gemfile.lock

Lines changed: 29 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -76,27 +76,28 @@ GEM
7676
addressable (2.8.7)
7777
public_suffix (>= 2.0.2, < 7.0)
7878
afm (0.2.2)
79-
annotaterb (4.16.0)
79+
annotaterb (4.19.0)
8080
activerecord (>= 6.0.0)
8181
activesupport (>= 6.0.0)
8282
ast (2.4.3)
8383
autoprefixer-rails (10.4.13.0)
8484
execjs (~> 2)
8585
awesome_print (1.9.2)
8686
aws-eventstream (1.4.0)
87-
aws-partitions (1.1123.0)
88-
aws-sdk-core (3.226.1)
87+
aws-partitions (1.1168.0)
88+
aws-sdk-core (3.233.0)
8989
aws-eventstream (~> 1, >= 1.3.0)
9090
aws-partitions (~> 1, >= 1.992.0)
9191
aws-sigv4 (~> 1.9)
9292
base64
93+
bigdecimal
9394
jmespath (~> 1, >= 1.6.1)
9495
logger
95-
aws-sdk-kms (1.106.0)
96-
aws-sdk-core (~> 3, >= 3.225.0)
96+
aws-sdk-kms (1.113.0)
97+
aws-sdk-core (~> 3, >= 3.231.0)
9798
aws-sigv4 (~> 1.5)
98-
aws-sdk-s3 (1.191.0)
99-
aws-sdk-core (~> 3, >= 3.225.0)
99+
aws-sdk-s3 (1.199.1)
100+
aws-sdk-core (~> 3, >= 3.231.0)
100101
aws-sdk-kms (~> 1)
101102
aws-sigv4 (~> 1.5)
102103
aws-sigv4 (1.12.1)
@@ -123,7 +124,7 @@ GEM
123124
erubi (~> 1.4)
124125
parser (>= 2.4)
125126
smart_properties
126-
bigdecimal (3.2.2)
127+
bigdecimal (3.2.3)
127128
bindex (0.8.1)
128129
binding_of_caller (1.0.1)
129130
debug_inspector (>= 1.2.0)
@@ -169,9 +170,9 @@ GEM
169170
cuprite (0.17)
170171
capybara (~> 3.0)
171172
ferrum (~> 0.17.0)
172-
database_cleaner-active_record (2.2.0)
173+
database_cleaner-active_record (2.2.2)
173174
activerecord (>= 5.a)
174-
database_cleaner-core (~> 2.0.0)
175+
database_cleaner-core (~> 2.0)
175176
database_cleaner-core (2.0.1)
176177
date (3.4.1)
177178
debug (1.11.0)
@@ -238,9 +239,9 @@ GEM
238239
smart_properties
239240
erubi (1.13.1)
240241
execjs (2.10.0)
241-
factory_bot (6.5.4)
242+
factory_bot (6.5.5)
242243
activesupport (>= 6.1.0)
243-
factory_bot_rails (6.5.0)
244+
factory_bot_rails (6.5.1)
244245
factory_bot (~> 6.5)
245246
railties (>= 6.1.0)
246247
faker (3.5.1)
@@ -340,7 +341,7 @@ GEM
340341
actionview (>= 5.0.0)
341342
activesupport (>= 5.0.0)
342343
jmespath (1.6.2)
343-
json (2.12.2)
344+
json (2.15.1)
344345
jwt (3.1.2)
345346
base64
346347
kaminari (1.2.2)
@@ -355,7 +356,7 @@ GEM
355356
activerecord
356357
kaminari-core (= 1.2.2)
357358
kaminari-core (1.2.2)
358-
knapsack_pro (8.3.3)
359+
knapsack_pro (8.4.0)
359360
rake
360361
language_server-protocol (3.17.0.5)
361362
launchy (3.0.0)
@@ -394,7 +395,6 @@ GEM
394395
memory_profiler (1.1.0)
395396
method_source (1.1.0)
396397
mini_mime (1.1.5)
397-
mini_portile2 (2.8.9)
398398
minitest (5.25.5)
399399
monetize (1.12.0)
400400
money (~> 6.12)
@@ -423,11 +423,8 @@ GEM
423423
timeout
424424
net-smtp (0.5.1)
425425
net-protocol
426-
newrelic_rpm (9.20.0)
426+
newrelic_rpm (9.21.0)
427427
nio4r (2.7.4)
428-
nokogiri (1.18.9)
429-
mini_portile2 (~> 2.8.2)
430-
racc (~> 1.4)
431428
nokogiri (1.18.9-arm64-darwin)
432429
racc (~> 1.4)
433430
nokogiri (1.18.9-x86_64-darwin)
@@ -469,7 +466,7 @@ GEM
469466
activerecord (>= 6.1)
470467
request_store (~> 1.4)
471468
parallel (1.27.0)
472-
parser (3.3.8.0)
469+
parser (3.3.9.0)
473470
ast (~> 2.4.1)
474471
racc
475472
pdf-core (0.9.0)
@@ -496,7 +493,7 @@ GEM
496493
prawn-table (0.2.2)
497494
prawn (>= 1.3.0, < 3.0.0)
498495
prettyprint (0.2.0)
499-
prism (1.4.0)
496+
prism (1.5.2)
500497
pry (0.14.2)
501498
coderay (~> 1.1)
502499
method_source (~> 1.0)
@@ -517,7 +514,7 @@ GEM
517514
date
518515
stringio
519516
public_suffix (6.0.2)
520-
puma (6.6.0)
517+
puma (7.0.4)
521518
nio4r (~> 2.0)
522519
racc (1.8.1)
523520
rack (3.2.1)
@@ -581,7 +578,7 @@ GEM
581578
erb
582579
psych (>= 4.0.0)
583580
recaptcha (5.20.1)
584-
regexp_parser (2.11.2)
581+
regexp_parser (2.11.3)
585582
reline (0.6.2)
586583
io-console (~> 0.5)
587584
request_store (1.7.0)
@@ -613,18 +610,18 @@ GEM
613610
rspec-mocks (~> 3.13)
614611
rspec-support (~> 3.13)
615612
rspec-support (3.13.4)
616-
rubocop (1.75.8)
613+
rubocop (1.80.2)
617614
json (~> 2.3)
618615
language_server-protocol (~> 3.17.0.2)
619616
lint_roller (~> 1.1.0)
620617
parallel (~> 1.10)
621618
parser (>= 3.3.0.2)
622619
rainbow (>= 2.2.2, < 4.0)
623620
regexp_parser (>= 2.9.3, < 3.0)
624-
rubocop-ast (>= 1.44.0, < 2.0)
621+
rubocop-ast (>= 1.46.0, < 2.0)
625622
ruby-progressbar (~> 1.7)
626623
unicode-display_width (>= 2.4.0, < 4.0)
627-
rubocop-ast (1.45.1)
624+
rubocop-ast (1.47.1)
628625
parser (>= 3.3.7.2)
629626
prism (~> 1.4)
630627
rubocop-performance (1.25.0)
@@ -692,10 +689,10 @@ GEM
692689
activesupport (>= 5.2)
693690
sprockets (>= 3.0.0)
694691
stackprof (0.2.27)
695-
standard (1.50.0)
692+
standard (1.51.1)
696693
language_server-protocol (~> 3.17.0.2)
697694
lint_roller (~> 1.0)
698-
rubocop (~> 1.75.5)
695+
rubocop (~> 1.80.2)
699696
standard-custom (~> 1.0.0)
700697
standard-performance (~> 1.8)
701698
standard-custom (1.0.2)
@@ -718,14 +715,14 @@ GEM
718715
tilt (2.2.0)
719716
timeout (0.4.3)
720717
ttfunk (1.7.0)
721-
turbo-rails (2.0.16)
718+
turbo-rails (2.0.17)
722719
actionpack (>= 7.1.0)
723720
railties (>= 7.1.0)
724721
tzinfo (2.0.6)
725722
concurrent-ruby (~> 1.0)
726-
unicode-display_width (3.1.4)
727-
unicode-emoji (~> 4.0, >= 4.0.4)
728-
unicode-emoji (4.0.4)
723+
unicode-display_width (3.2.0)
724+
unicode-emoji (~> 4.1)
725+
unicode-emoji (4.1.0)
729726
uniform_notifier (1.17.0)
730727
uri (1.0.3)
731728
useragent (0.16.11)
@@ -753,7 +750,6 @@ GEM
753750

754751
PLATFORMS
755752
arm64-darwin
756-
ruby
757753
x86_64-darwin
758754
x86_64-linux
759755
x86_64-linux-gnu

app/controllers/audits_controller.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ def index
77
@selected_location = filter_params[:at_location]
88
@audits = current_organization.audits.includes(:line_items, :storage_location).class_filter(filter_params)
99
@storage_locations = StorageLocation.with_audits_for(current_organization).select(:id, :name)
10+
11+
respond_to do |format|
12+
format.html
13+
format.csv do
14+
send_data Audit.generate_csv(@audits), filename: "Audits-#{Time.zone.today}.csv"
15+
end
16+
end
1017
end
1118

1219
def show

app/controllers/distributions_controller.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,13 @@ def print
2727
end
2828

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

3233
if result.success?
3334
flash[:notice] = "Distribution #{params[:id]} has been reclaimed!"
3435
else
35-
flash[:error] = "Could not destroy distribution #{params[:id]}. Please contact technical support."
36+
flash[:error] = result.error.message
3637
end
3738

3839
redirect_to distributions_path
@@ -185,9 +186,10 @@ def edit
185186
@request = @distribution.request
186187
@items = current_organization.items.active.alphabetized
187188
@partner_list = current_organization.partners.alphabetized
189+
@changes_disallowed = SnapshotEvent.intervening(@distribution).present?
188190
@audit_warning = current_organization.audits
189191
.where(storage_location_id: @distribution.storage_location_id)
190-
.where("updated_at > ?", @distribution.created_at).any?
192+
.where("updated_at > ?", @distribution.created_at).any? && !@changes_disallowed
191193
inventory = View::Inventory.new(@distribution.organization_id)
192194
@storage_locations = current_organization.storage_locations.active.alphabetized.select do |storage_loc|
193195
!inventory.quantity_for(storage_location: storage_loc.id).negative?

app/controllers/donations_controller.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ def new
5555
def edit
5656
@donation = Donation.find(params[:id])
5757
@donation.line_items.build
58-
@audit_performed_and_finalized = Audit.finalized_since?(@donation, @donation.storage_location_id)
58+
@changes_disallowed = SnapshotEvent.intervening(@donation).present?
59+
@audit_performed_and_finalized = Audit.finalized_since?(@donation, @donation.storage_location_id) &&
60+
!@changes_disallowed
5961

6062
load_form_collections
6163
end
@@ -91,7 +93,7 @@ def destroy
9193
if service.success?
9294
flash[:notice] = "Donation #{params[:id]} has been removed!"
9395
else
94-
flash[:error] = "Donation #{params[:id]} failed to be removed because #{service.error}"
96+
flash[:error] = service.error.message
9597
end
9698

9799
redirect_to donations_path

app/controllers/partners/family_requests_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
module Partners
22
class FamilyRequestsController < BaseController
33
include Validatable
4+
45
before_action :verify_partner_is_active
56
before_action :authorize_verified_partners
67

app/controllers/partners/individuals_requests_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
module Partners
22
class IndividualsRequestsController < BaseController
33
include Validatable
4+
45
before_action :verify_partner_is_active
56
before_action :authorize_verified_partners
67

app/controllers/partners/requests_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
module Partners
22
class RequestsController < BaseController
33
include Validatable
4+
45
skip_before_action :require_partner, only: [:new, :create, :validate]
56
before_action :require_partner_or_org_admin, only: [:new, :create, :validate]
67
layout :layout

app/controllers/partners_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# of which Partners are associated with which Diaperbanks.
44
class PartnersController < ApplicationController
55
include Importable
6+
67
before_action :validate_user_role, only: :show
78
skip_before_action :require_organization, only: :show
89

app/controllers/product_drives_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
class ProductDrivesController < ApplicationController
22
include Importable
3+
34
before_action :set_product_drive, only: [:show, :edit, :update, :destroy]
45
before_action :set_tags, only: [:index, :new, :edit]
56

app/controllers/purchases_controller.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,9 @@ def new
6363
def edit
6464
@purchase = current_organization.purchases.find(params[:id])
6565
@purchase.line_items.build
66-
@audit_performed_and_finalized = Audit.finalized_since?(@purchase, @purchase.storage_location_id)
66+
@changes_disallowed = SnapshotEvent.intervening(@purchase).present?
67+
@audit_performed_and_finalized = Audit.finalized_since?(@purchase, @purchase.storage_location_id) &&
68+
!@changes_disallowed
6769

6870
load_form_collections(@purchase)
6971
end

0 commit comments

Comments
 (0)