Skip to content

Commit 59bd77a

Browse files
authored
Merge branch 'main' into dependabot/bundler/rubocop-rails-2.27.0
2 parents 01e3818 + 8da1718 commit 59bd77a

Some content is hidden

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

41 files changed

+512
-156
lines changed

Gemfile.lock

Lines changed: 41 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ GEM
9393
nokogiri (~> 1, >= 1.10.8)
9494
base64 (0.2.0)
9595
bcrypt (3.1.20)
96-
benchmark (0.3.0)
96+
benchmark (0.4.0)
9797
better_errors (2.10.1)
9898
erubi (>= 1.0.0)
9999
rack (>= 0.9.0)
@@ -162,8 +162,8 @@ GEM
162162
irb (~> 1.10)
163163
reline (>= 0.3.8)
164164
debug_inspector (1.2.0)
165-
delayed_job (4.1.11)
166-
activesupport (>= 3.0, < 8.0)
165+
delayed_job (4.1.13)
166+
activesupport (>= 3.0, < 9.0)
167167
delayed_job_active_record (4.1.8)
168168
activerecord (>= 3.0, < 8.0)
169169
delayed_job (>= 3.0, < 5)
@@ -218,10 +218,10 @@ GEM
218218
smart_properties
219219
erubi (1.13.0)
220220
execjs (2.10.0)
221-
factory_bot (6.4.5)
221+
factory_bot (6.5.0)
222222
activesupport (>= 5.0.0)
223-
factory_bot_rails (6.4.3)
224-
factory_bot (~> 6.4)
223+
factory_bot_rails (6.4.4)
224+
factory_bot (~> 6.5)
225225
railties (>= 5.0.0)
226226
faker (3.4.2)
227227
i18n (>= 1.8.11, < 2)
@@ -314,14 +314,14 @@ GEM
314314
actionpack (>= 6.0.0)
315315
activesupport (>= 6.0.0)
316316
railties (>= 6.0.0)
317-
io-console (0.7.2)
318-
irb (1.14.1)
317+
io-console (0.8.0)
318+
irb (1.14.3)
319319
rdoc (>= 4.0.0)
320320
reline (>= 0.4.2)
321321
jbuilder (2.13.0)
322322
actionview (>= 5.0.0)
323323
activesupport (>= 5.0.0)
324-
json (2.7.5)
324+
json (2.9.1)
325325
jwt (2.9.1)
326326
base64
327327
kaminari (1.2.2)
@@ -348,7 +348,7 @@ GEM
348348
listen (3.9.0)
349349
rb-fsevent (~> 0.10, >= 0.10.3)
350350
rb-inotify (~> 0.9, >= 0.9.10)
351-
logger (1.6.1)
351+
logger (1.6.3)
352352
lograge (0.14.0)
353353
actionpack (>= 4)
354354
activesupport (>= 4)
@@ -373,7 +373,7 @@ GEM
373373
method_source (1.1.0)
374374
mini_magick (4.13.2)
375375
mini_mime (1.1.5)
376-
minitest (5.25.1)
376+
minitest (5.25.4)
377377
monetize (1.12.0)
378378
money (~> 6.12)
379379
money (6.16.0)
@@ -401,13 +401,13 @@ GEM
401401
timeout
402402
net-smtp (0.5.0)
403403
net-protocol
404-
newrelic_rpm (9.13.0)
404+
newrelic_rpm (9.16.0)
405405
nio4r (2.7.4)
406-
nokogiri (1.16.7-arm64-darwin)
406+
nokogiri (1.17.2-arm64-darwin)
407407
racc (~> 1.4)
408-
nokogiri (1.16.7-x86_64-darwin)
408+
nokogiri (1.17.2-x86_64-darwin)
409409
racc (~> 1.4)
410-
nokogiri (1.16.7-x86_64-linux)
410+
nokogiri (1.17.2-x86_64-linux)
411411
racc (~> 1.4)
412412
notiffany (0.1.3)
413413
nenv (~> 0.1)
@@ -442,7 +442,7 @@ GEM
442442
activerecord (>= 6.1)
443443
request_store (~> 1.4)
444444
parallel (1.26.3)
445-
parser (3.3.5.1)
445+
parser (3.3.6.0)
446446
ast (~> 2.4.1)
447447
racc
448448
pdf-core (0.9.0)
@@ -479,10 +479,11 @@ GEM
479479
pry-stack_explorer (0.6.1)
480480
binding_of_caller (~> 1.0)
481481
pry (~> 0.13)
482-
psych (5.1.2)
482+
psych (5.2.2)
483+
date
483484
stringio
484485
public_suffix (6.0.1)
485-
puma (6.4.3)
486+
puma (6.5.0)
486487
nio4r (~> 2.0)
487488
racc (1.8.1)
488489
rack (3.1.8)
@@ -522,9 +523,9 @@ GEM
522523
activesupport (>= 4.2)
523524
choice (~> 0.2.0)
524525
ruby-graphviz (~> 1.2)
525-
rails-html-sanitizer (1.6.0)
526+
rails-html-sanitizer (1.6.2)
526527
loofah (~> 2.21)
527-
nokogiri (~> 1.14)
528+
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
528529
railties (7.2.2)
529530
actionpack (= 7.2.2)
530531
activesupport (= 7.2.2)
@@ -538,15 +539,15 @@ GEM
538539
rb-fsevent (0.11.2)
539540
rb-inotify (0.10.1)
540541
ffi (~> 1.0)
541-
rdoc (6.7.0)
542+
rdoc (6.10.0)
542543
psych (>= 4.0.0)
543544
recaptcha (5.17.0)
544545
redis (5.3.0)
545546
redis-client (>= 0.22.0)
546547
redis-client (0.22.2)
547548
connection_pool
548-
regexp_parser (2.9.2)
549-
reline (0.5.10)
549+
regexp_parser (2.9.3)
550+
reline (0.6.0)
550551
io-console (~> 0.5)
551552
request_store (1.7.0)
552553
rack (>= 1.4)
@@ -577,20 +578,19 @@ GEM
577578
rspec-mocks (~> 3.13)
578579
rspec-support (~> 3.13)
579580
rspec-support (3.13.1)
580-
rubocop (1.65.1)
581+
rubocop (1.69.2)
581582
json (~> 2.3)
582583
language_server-protocol (>= 3.17.0)
583584
parallel (~> 1.10)
584585
parser (>= 3.3.0.2)
585586
rainbow (>= 2.2.2, < 4.0)
586-
regexp_parser (>= 2.4, < 3.0)
587-
rexml (>= 3.2.5, < 4.0)
588-
rubocop-ast (>= 1.31.1, < 2.0)
587+
regexp_parser (>= 2.9.3, < 3.0)
588+
rubocop-ast (>= 1.36.2, < 2.0)
589589
ruby-progressbar (~> 1.7)
590-
unicode-display_width (>= 2.4.0, < 3.0)
591-
rubocop-ast (1.33.0)
590+
unicode-display_width (>= 2.4.0, < 4.0)
591+
rubocop-ast (1.37.0)
592592
parser (>= 3.3.1.0)
593-
rubocop-performance (1.22.1)
593+
rubocop-performance (1.23.0)
594594
rubocop (>= 1.48.1, < 2.0)
595595
rubocop-ast (>= 1.31.1, < 2.0)
596596
rubocop-rails (2.27.0)
@@ -619,7 +619,7 @@ GEM
619619
sprockets (> 3.0)
620620
sprockets-rails
621621
tilt
622-
securerandom (0.3.1)
622+
securerandom (0.4.1)
623623
shellany (0.0.1)
624624
shoulda-matchers (6.2.0)
625625
activesupport (>= 5.2.0)
@@ -650,21 +650,21 @@ GEM
650650
actionpack (>= 5.2)
651651
activesupport (>= 5.2)
652652
sprockets (>= 3.0.0)
653-
standard (1.40.0)
653+
standard (1.43.0)
654654
language_server-protocol (~> 3.17.0.2)
655655
lint_roller (~> 1.0)
656-
rubocop (~> 1.65.0)
656+
rubocop (~> 1.69.1)
657657
standard-custom (~> 1.0.0)
658-
standard-performance (~> 1.4)
658+
standard-performance (~> 1.6)
659659
standard-custom (1.0.2)
660660
lint_roller (~> 1.0)
661661
rubocop (~> 1.50)
662-
standard-performance (1.5.0)
662+
standard-performance (1.6.0)
663663
lint_roller (~> 1.1)
664-
rubocop-performance (~> 1.22.0)
664+
rubocop-performance (~> 1.23.0)
665665
stimulus-rails (1.3.4)
666666
railties (>= 6.0.0)
667-
stringio (3.1.1)
667+
stringio (3.1.2)
668668
strong_migrations (1.8.0)
669669
activerecord (>= 5.2)
670670
terser (1.2.4)
@@ -678,7 +678,9 @@ GEM
678678
railties (>= 6.0.0)
679679
tzinfo (2.0.6)
680680
concurrent-ruby (~> 1.0)
681-
unicode-display_width (2.6.0)
681+
unicode-display_width (3.1.2)
682+
unicode-emoji (~> 4.0, >= 4.0.4)
683+
unicode-emoji (4.0.4)
682684
uniform_notifier (1.16.0)
683685
useragent (0.16.10)
684686
version_gem (1.1.4)
@@ -693,7 +695,7 @@ GEM
693695
addressable (>= 2.8.0)
694696
crack (>= 0.3.2)
695697
hashdiff (>= 0.4.0, < 2.0.0)
696-
webrick (1.9.0)
698+
webrick (1.9.1)
697699
websocket-driver (0.7.6)
698700
websocket-extensions (>= 0.1.0)
699701
websocket-extensions (0.1.5)

app/controllers/dashboard_controller.rb

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,13 @@ class DashboardController < ApplicationController
44

55
def index
66
@org_stats = OrganizationStats.new(current_organization)
7-
@total_inventory = current_organization.total_inventory
87
@partners_awaiting_review = current_organization.partners.awaiting_review
9-
@outstanding_requests = current_organization.ordered_requests.where(status: %i[pending started]).order(:created_at)
8+
@outstanding_requests = current_organization
9+
.ordered_requests
10+
.includes(:partner_user, :partner)
11+
.where(status: %i[pending started])
12+
.order(:created_at)
13+
.limit(25)
1014

1115
@low_inventory_report = LowInventoryQuery.call(current_organization)
1216

app/controllers/distributions_controller.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ def update
205205
@distribution.line_items.build if @distribution.line_items.size.zero?
206206
@distribution.initialize_request_items
207207
@items = current_organization.items.active.alphabetized
208+
@partner_list = current_organization.partners.alphabetized
208209
@storage_locations = current_organization.storage_locations.active_locations.alphabetized
209210
render :edit
210211
end

app/controllers/partners/family_requests_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def create
1919
create_service = Partners::FamilyRequestCreateService.new(
2020
partner_user_id: current_user.id,
2121
family_requests_attributes: family_requests_attributes,
22-
for_families: true
22+
request_type: "child"
2323
)
2424

2525
create_service.call
@@ -37,7 +37,7 @@ def validate
3737
@partner_request = Partners::FamilyRequestCreateService.new(
3838
partner_user_id: current_user.id,
3939
family_requests_attributes: family_requests_attributes,
40-
for_families: true
40+
request_type: "child"
4141
).initialize_only
4242
if @partner_request.valid?
4343
@total_items = @partner_request.total_items

app/controllers/partners/individuals_requests_controller.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ def create
1212
create_service = Partners::FamilyRequestCreateService.new(
1313
partner_user_id: current_user.id,
1414
comments: individuals_request_params[:comments],
15-
family_requests_attributes: individuals_request_params[:items_attributes]&.values
15+
family_requests_attributes: individuals_request_params[:items_attributes]&.values,
16+
request_type: "individual"
1617
)
1718

1819
create_service.call
@@ -36,7 +37,8 @@ def validate
3637
@partner_request = Partners::FamilyRequestCreateService.new(
3738
partner_user_id: current_user.id,
3839
comments: individuals_request_params[:comments],
39-
family_requests_attributes: individuals_request_params[:items_attributes]&.values
40+
family_requests_attributes: individuals_request_params[:items_attributes]&.values,
41+
request_type: "individual"
4042
).initialize_only
4143
if @partner_request.valid?
4244
@total_items = @partner_request.total_items

app/models/concerns/issued_at.rb

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,18 @@ module IssuedAt
55
extend ActiveSupport::Concern
66

77
included do
8-
before_create :initialize_issued_at
9-
before_save :initialize_issued_at
108
scope :by_issued_at, ->(issued_at) { where(issued_at: issued_at.beginning_of_month..issued_at.end_of_month) }
119
scope :for_year, ->(year) { where("extract(year from issued_at) = ?", year) }
10+
validates :issued_at, presence: true
1211
validate :issued_at_cannot_be_before_2000
1312
validate :issued_at_cannot_be_further_than_1_year
1413
end
1514

1615
private
1716

18-
def initialize_issued_at
19-
self.issued_at ||= created_at&.end_of_day
20-
end
21-
2217
def issued_at_cannot_be_before_2000
2318
if issued_at.present? && issued_at < Date.new(2000, 1, 1)
24-
errors.add(:issued_at, "Cannot be before 2000")
19+
errors.add(:issued_at, "cannot be before 2000")
2520
end
2621
end
2722

app/models/partner.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ class Partner < ApplicationRecord
7474
AGENCY_TYPES = {
7575
"CAREER" => "Career technical training",
7676
"ABUSE" => "Child abuse resource center",
77+
"BNB" => "Basic Needs Bank",
7778
"CHURCH" => "Church outreach ministry",
7879
"COLLEGE" => "College and Universities",
7980
"CDC" => "Community development corporation",
@@ -82,6 +83,7 @@ class Partner < ApplicationRecord
8283
"LEGAL" => "Correctional Facilities / Jail / Prison / Legal System",
8384
"CRISIS" => "Crisis/Disaster services",
8485
"DISAB" => "Developmental disabilities program",
86+
"DISTRICT" => "School District",
8587
"DOMV" => "Domestic violence shelter",
8688
"ECE" => "Early Childhood Education/Childcare",
8789
"CHILD" => "Early childhood services",
@@ -96,6 +98,7 @@ class Partner < ApplicationRecord
9698
"HOSP" => "Hospital",
9799
"INFPAN" => "Infant/Child Pantry/Closet",
98100
"LIB" => "Library",
101+
"MHEALTH" => "Mental Health",
99102
"MILITARY" => "Military Bases/Veteran Services",
100103
"POLICE" => "Police Station",
101104
"PREG" => "Pregnancy resource center",

app/pdfs/distribution_pdf.rb

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,6 @@ def request_data
162162
"Value/item",
163163
"In-Kind Value Received",
164164
"Packages"]]
165-
166-
inventory = nil
167165
inventory = View::Inventory.new(@distribution.organization_id)
168166
request_items = @distribution.request.request_items.map do |request_item|
169167
RequestItem.from_json(request_item, @distribution.request, inventory)

app/services/partners/family_request_create_service.rb

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ module Partners
66
class FamilyRequestCreateService
77
include ServiceObjectErrorsMixin
88

9-
attr_reader :partner_user_id, :comments, :family_requests_attributes, :partner_request
9+
attr_reader :partner_user_id, :comments, :family_requests_attributes, :partner_request, :request_type
1010

11-
def initialize(partner_user_id:, family_requests_attributes:, comments: nil, for_families: false)
11+
def initialize(partner_user_id:, family_requests_attributes:, request_type:, comments: nil)
1212
@partner_user_id = partner_user_id
1313
@comments = comments
1414
@family_requests_attributes = family_requests_attributes.presence || []
15-
@for_families = for_families
15+
@request_type = request_type
1616
end
1717

1818
def call
@@ -81,9 +81,5 @@ def convert_person_count_to_item_quantity(item_id:, person_count:)
8181
def included_items_by_id
8282
@included_items_by_id ||= Item.where(id: family_requests_attributes.pluck(:item_id)).index_by(&:id)
8383
end
84-
85-
def request_type
86-
@for_families ? "child" : "individual"
87-
end
8884
end
8985
end

0 commit comments

Comments
 (0)