Skip to content

Commit 02e3569

Browse files
authored
Rename active_locations scope to active (#4953)
1 parent 19825ee commit 02e3569

File tree

15 files changed

+29
-29
lines changed

15 files changed

+29
-29
lines changed

app/controllers/adjustments_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def show
3333
def new
3434
@adjustment = current_organization.adjustments.new
3535
@adjustment.line_items.build
36-
@storage_locations = current_organization.storage_locations.active_locations
36+
@storage_locations = current_organization.storage_locations.active
3737
@items = current_organization.items.loose.active.alphabetized
3838
end
3939

@@ -54,7 +54,7 @@ def create
5454
private
5555

5656
def load_form_collections
57-
@storage_locations = current_organization.storage_locations.active_locations
57+
@storage_locations = current_organization.storage_locations.active
5858
@items = current_organization.items.loose.alphabetized
5959
end
6060

app/controllers/audits_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def set_audit
8989
end
9090

9191
def set_storage_locations
92-
@storage_locations = current_organization.storage_locations.active_locations
92+
@storage_locations = current_organization.storage_locations.active
9393
end
9494

9595
def set_items

app/controllers/distributions_controller.rb

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def index
4949
@paginated_distributions = @distributions.page(params[:page])
5050
@items = current_organization.items.alphabetized.select(:id, :name)
5151
@item_categories = current_organization.item_categories.select(:id, :name)
52-
@storage_locations = current_organization.storage_locations.active_locations.alphabetized.select(:id, :name)
52+
@storage_locations = current_organization.storage_locations.active.alphabetized.select(:id, :name)
5353
@partners = current_organization.partners.active.alphabetized.select(:id, :name)
5454
@selected_item = filter_params[:by_item_id].presence
5555
@distribution_totals = DistributionTotalsService.new(current_organization.distributions, scope_filters)
@@ -122,7 +122,7 @@ def create
122122
@partner_list = current_organization.partners.where.not(status: 'deactivated').alphabetized
123123

124124
inventory = View::Inventory.new(@distribution.organization_id)
125-
@storage_locations = current_organization.storage_locations.active_locations.alphabetized.select do |storage_loc|
125+
@storage_locations = current_organization.storage_locations.active.alphabetized.select do |storage_loc|
126126
inventory.quantity_for(storage_location: storage_loc.id).positive?
127127
end
128128
if @distribution.storage_location.present?
@@ -157,7 +157,7 @@ def new
157157
@partner_list = current_organization.partners.where.not(status: 'deactivated').alphabetized
158158

159159
inventory = View::Inventory.new(current_organization.id)
160-
@storage_locations = current_organization.storage_locations.active_locations.alphabetized.select do |storage_loc|
160+
@storage_locations = current_organization.storage_locations.active.alphabetized.select do |storage_loc|
161161
inventory.quantity_for(storage_location: storage_loc.id).positive?
162162
end
163163
end
@@ -185,7 +185,7 @@ def edit
185185
.where(storage_location_id: @distribution.storage_location_id)
186186
.where("updated_at > ?", @distribution.created_at).any?
187187
inventory = View::Inventory.new(@distribution.organization_id)
188-
@storage_locations = current_organization.storage_locations.active_locations.alphabetized.select do |storage_loc|
188+
@storage_locations = current_organization.storage_locations.active.alphabetized.select do |storage_loc|
189189
!inventory.quantity_for(storage_location: storage_loc.id).negative?
190190
end
191191
else
@@ -212,7 +212,7 @@ def update
212212
@distribution.initialize_request_items
213213
@items = current_organization.items.active.alphabetized
214214
@partner_list = current_organization.partners.alphabetized
215-
@storage_locations = current_organization.storage_locations.active_locations.alphabetized
215+
@storage_locations = current_organization.storage_locations.active.alphabetized
216216
render :edit
217217
end
218218
end

app/controllers/donations_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ def destroy
123123
private
124124

125125
def load_form_collections
126-
@storage_locations = current_organization.storage_locations.active_locations.alphabetized
126+
@storage_locations = current_organization.storage_locations.active.alphabetized
127127
@donation_sites = current_organization.donation_sites.active.alphabetized
128128
@product_drives = current_organization.product_drives.alphabetized
129129
@product_drive_participants = current_organization.product_drive_participants.alphabetized

app/controllers/items_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def index
1212

1313
@item_categories = current_organization.item_categories.includes(:items).order('name ASC')
1414
@kits = current_organization.kits.includes(line_items: :item)
15-
@storages = current_organization.storage_locations.active_locations.order(id: :asc)
15+
@storages = current_organization.storage_locations.active.order(id: :asc)
1616

1717
@include_inactive_items = params[:include_inactive_items]
1818
@selected_base_item = filter_params[:by_base_item]

app/controllers/kits_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,15 @@ def reactivate
5353

5454
def allocations
5555
@kit = Kit.find(params[:id])
56-
@storage_locations = current_organization.storage_locations.active_locations
56+
@storage_locations = current_organization.storage_locations.active
5757
@inventory = View::Inventory.new(current_organization.id)
5858

5959
load_form_collections
6060
end
6161

6262
def allocate
6363
@kit = Kit.find(params[:id])
64-
@storage_location = current_organization.storage_locations.active_locations.find(kit_adjustment_params[:storage_location_id])
64+
@storage_location = current_organization.storage_locations.active.find(kit_adjustment_params[:storage_location_id])
6565
@change_by = kit_adjustment_params[:change_by].to_i
6666
begin
6767
if @change_by.positive?

app/controllers/purchases_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def index
2323
@total_fair_market_values = @purchases.sum(&:value_per_itemizable)
2424
@paginated_fair_market_values = @paginated_purchases.collect(&:value_per_itemizable).sum
2525
# Storage and Vendor
26-
@storage_locations = current_organization.storage_locations.active_locations
26+
@storage_locations = current_organization.storage_locations.active
2727
@selected_storage_location = filter_params[:at_storage_location]
2828
@vendors = current_organization.vendors.sort_by { |vendor| vendor.business_name.downcase }
2929
@selected_vendor = filter_params[:from_vendor]
@@ -99,7 +99,7 @@ def destroy
9999
private
100100

101101
def load_form_collections
102-
@storage_locations = current_organization.storage_locations.active_locations.alphabetized
102+
@storage_locations = current_organization.storage_locations.active.alphabetized
103103
@items = current_organization.items.active.alphabetized
104104
@vendors = current_organization.vendors.alphabetized
105105
end

app/controllers/transfers_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def create
3434
def new
3535
@transfer = current_organization.transfers.new
3636
@transfer.line_items.build
37-
@storage_locations = current_organization.storage_locations.active_locations.alphabetized
37+
@storage_locations = current_organization.storage_locations.active.alphabetized
3838
@items = current_organization.items.active.alphabetized
3939
end
4040

@@ -60,7 +60,7 @@ def destroy
6060
private
6161

6262
def load_form_collections
63-
@storage_locations = current_organization.storage_locations.active_locations.alphabetized
63+
@storage_locations = current_organization.storage_locations.active.alphabetized
6464
@items = current_organization.items.alphabetized
6565
end
6666

app/models/storage_location.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class StorageLocation < ApplicationRecord
5454

5555
scope :alphabetized, -> { order(:name) }
5656
scope :for_csv_export, ->(organization, *) { where(organization: organization) }
57-
scope :active_locations, -> { where(discarded_at: nil) }
57+
scope :active, -> { where(discarded_at: nil) }
5858
scope :with_transfers_to, ->(organization) {
5959
joins(:transfers_to).where(organization_id: organization.id).distinct.order(:name)
6060
}

app/models/view/inventory.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def initialize(organization_id, event_time: nil)
5353
def reload(event_time = nil)
5454
@inventory = InventoryAggregate.inventory_for(organization_id, event_time: event_time)
5555
@items = Item.where(organization_id: organization_id).active
56-
@db_storage_locations = StorageLocation.where(organization_id: organization_id).active_locations
56+
@db_storage_locations = StorageLocation.where(organization_id: organization_id).active
5757
load_item_details
5858
end
5959

0 commit comments

Comments
 (0)