Skip to content

Commit 5417ec2

Browse files
committed
Remove methods and test set up to calculate per person per month
1 parent fc10668 commit 5417ec2

File tree

2 files changed

+0
-25
lines changed

2 files changed

+0
-25
lines changed

app/services/reports/period_supply_report_service.rb

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ def report
1515
@report ||= {name: "Period Supplies",
1616
entries: {
1717
"Period supplies distributed" => number_with_delimiter(total_distributed_period_supplies),
18-
"Period supplies per adult per month" => (monthly_supplies + distributed_period_supplies_from_kits_per_month)&.round,
1918
"Period supplies" => types_of_supplies,
2019
"% period supplies donated" => "#{percent_donated.round}%",
2120
"% period supplies bought" => "#{percent_bought.round}%",
@@ -37,27 +36,10 @@ def distributed_period_supplies_from_kits
3736
kit_items_calculation("distributions", "Distribution")
3837
end
3938

40-
def distributed_period_supplies_from_kits_per_month
41-
distributed_period_supplies_from_kits / 12 || 0
42-
end
43-
4439
def total_distributed_period_supplies
4540
distributed_loose_period_supplies + distributed_period_supplies_from_kits
4641
end
4742

48-
# @return [Integer]
49-
def monthly_supplies
50-
# NOTE: This is asking "per adult per month" but there doesn't seem to be much difference
51-
# in calculating per month or per any other time frame, since all it's really asking
52-
# is the value of the `distribution_quantity` field for the items we're giving out.
53-
organization
54-
.distributions
55-
.for_year(year)
56-
.joins(line_items: :item)
57-
.merge(Item.period_supplies)
58-
.average("COALESCE(items.distribution_quantity, 50)") || 0
59-
end
60-
6143
def types_of_supplies
6244
organization.items.period_supplies.map(&:name).uniq.sort.join(", ")
6345
end

spec/services/reports/period_supply_report_service_spec.rb

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
"% period supplies bought" => "0%",
1414
"% period supplies donated" => "0%",
1515
"Period supplies distributed" => "0",
16-
"Period supplies per adult per month" => 0,
1716
"Money spent purchasing period supplies" => "$0.00"
1817
}))
1918
expect(report.report[:entries]["Period supplies"].split(", "))
@@ -77,11 +76,6 @@
7776

7877
create(:line_item, :purchase, quantity: 30, item: purchased_period_supply_kit.item, itemizable: kit_purchase)
7978

80-
# create(:purchase, issued_at: within_time, organization: organization, line_items: [
81-
# create(:line_item, :purchase, item: period_supplies_kit_item, quantity: 5),
82-
# create(:line_item, :purchase, item: purchased_period_supply_kit_item, quantity: 5)
83-
# ])
84-
8579
# Distributions
8680
distributions = create_list(:distribution, 2, issued_at: within_time, organization: organization)
8781
outside_distributions = create_list(:distribution, 2, issued_at: outside_time, organization: organization)
@@ -143,7 +137,6 @@
143137
"% period supplies bought" => "67%",
144138
"% period supplies donated" => "33%",
145139
"Period supplies distributed" => "2,300",
146-
"Period supplies per adult per month" => 45,
147140
"Money spent purchasing period supplies" => "$40.00"
148141
}))
149142
expect(report.report[:entries]["Period supplies"].split(", "))

0 commit comments

Comments
 (0)