Skip to content

Commit 53def81

Browse files
authored
Remove old/unused #for_csv_export methods (#4995)
1 parent f43336f commit 53def81

File tree

14 files changed

+0
-82
lines changed

14 files changed

+0
-82
lines changed

app/models/adjustment.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@ class Adjustment < ApplicationRecord
2222
include Filterable
2323
scope :at_location, ->(location_id) { where(storage_location_id: location_id) }
2424
scope :by_user, ->(user_id) { where(user_id: user_id) }
25-
scope :for_csv_export, ->(organization, *) {
26-
where(organization: organization)
27-
.includes(:storage_location, :line_items)
28-
}
2925
scope :during, ->(range) { where(adjustments: { created_at: range }) }
3026

3127
validate :storage_locations_belong_to_organization

app/models/barcode_item.rb

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,6 @@ class BarcodeItem < ApplicationRecord
4242

4343
scope :by_value, ->(value) { where(value: value) }
4444

45-
scope :for_csv_export, ->(organization, *) {
46-
where(organization: organization)
47-
.includes(:barcodeable)
48-
}
49-
5045
scope :global, -> { where(barcodeable_type: "BaseItem") }
5146

5247
# aliases of barcodeable

app/models/concerns/provideable.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ module Provideable
88
included do
99
belongs_to :organization # Automatically validates presence as of Rails 5
1010

11-
scope :for_csv_export, ->(organization, *) {
12-
where(organization: organization).order(:business_name)
13-
}
14-
1511
def self.import_csv(csv, organization)
1612
csv.each do |row|
1713
loc = new(row.to_hash)

app/models/distribution.rb

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,6 @@ class Distribution < ApplicationRecord
6161
scope :recent, ->(count = 3) { order(issued_at: :desc).limit(count) }
6262
scope :future, -> { where(issued_at: Time.zone.tomorrow..) }
6363
scope :during, ->(range) { where(distributions: { issued_at: range }) }
64-
scope :for_csv_export, ->(organization, filters = {}, date_range = nil) {
65-
where(organization: organization)
66-
.includes(:partner, :storage_location, :line_items)
67-
.apply_filters(filters, date_range)
68-
}
6964
scope :apply_filters, ->(filters, date_range) {
7065
class_filter(filters.merge(during: date_range))
7166
}

app/models/donation.rb

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,6 @@ class Donation < ApplicationRecord
5151
scope :from_manufacturer, ->(manufacturer_id) {
5252
where(manufacturer_id: manufacturer_id)
5353
}
54-
scope :for_csv_export, ->(organization, *) {
55-
where(organization: organization)
56-
.includes(:line_items, :storage_location, :donation_site)
57-
.order(created_at: :desc)
58-
}
5954

6055
before_create :combine_duplicates
6156

app/models/donation_site.rb

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,6 @@ class DonationSite < ApplicationRecord
3131
include Geocodable
3232
include Exportable
3333

34-
scope :for_csv_export, ->(organization, *) {
35-
where(organization: organization)
36-
.order(:name)
37-
}
38-
3934
scope :active, -> { where(active: true) }
4035

4136
scope :alphabetized, -> { order(:name) }

app/models/item.rb

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,6 @@ class Item < ApplicationRecord
6060
scope :by_partner_key, ->(partner_key) { where(partner_key: partner_key) }
6161

6262
scope :by_size, ->(size) { joins(:base_item).where(base_items: { size: size }) }
63-
scope :for_csv_export, ->(organization, *) {
64-
where(organization: organization)
65-
.includes(:base_item)
66-
.alphabetized
67-
}
6863

6964
# Scopes - explanation of business rules for filtering scopes as of 20240527. This was a mess, but is much better now.
7065
# 1/ Disposable. Disposables are only the disposable diapers for children. So we deliberately exclude adult and cloth

app/models/partner.rb

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,6 @@ class Partner < ApplicationRecord
5757
before_save { email&.downcase! }
5858
before_update :invite_new_partner, if: :should_invite_because_email_changed?
5959

60-
scope :for_csv_export, ->(organization, *) {
61-
where(organization: organization)
62-
.order(:name)
63-
}
64-
6560
scope :alphabetized, -> { order(:name) }
6661
scope :active, -> { where.not(status: :deactivated) }
6762

app/models/purchase.rb

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,6 @@ class Purchase < ApplicationRecord
4848
scope :purchased_from, ->(purchased_from) { where(purchased_from: purchased_from) }
4949
scope :during, ->(range) { where(purchases: { issued_at: range }) }
5050
scope :recent, ->(count = 3) { order(issued_at: :desc).limit(count) }
51-
scope :for_csv_export, ->(organization, *) {
52-
where(organization: organization)
53-
.includes(:line_items, :storage_location)
54-
.order(created_at: :desc)
55-
}
5651

5752
scope :active, -> { joins(:line_items).joins(:items).where(items: { active: true }) }
5853

app/models/request.rb

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,6 @@ class Request < ApplicationRecord
4949
scope :by_status, ->(status) { where(status: status) }
5050
scope :by_request_type, ->(request_type) { where(request_type: request_type) }
5151
scope :during, ->(range) { where(created_at: range) }
52-
scope :for_csv_export, ->(organization, *) {
53-
where(organization: organization)
54-
.includes(:partner)
55-
.order(created_at: :desc)
56-
}
5752

5853
def total_items
5954
request_items.sum { |item| item["quantity"] }

0 commit comments

Comments
 (0)