We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b9476c5 commit 51d0254Copy full SHA for 51d0254
1 file changed
app/services/reports/adult_incontinence_report_service.rb
@@ -148,7 +148,7 @@ def total_distributed_kits_containing_adult_incontinence_items_per_month
148
kit.items.adult_incontinence.exists?
149
end
150
151
- total_assisted_adults = kits.sum do |kit|
+ total_assisted_adults = kits.sum do |kit|
152
kit_item = Item.where(kit_id: kit.id).first
153
154
next 0 unless kit_item
@@ -157,7 +157,7 @@ def total_distributed_kits_containing_adult_incontinence_items_per_month
157
.distributions
158
.for_year(year)
159
.joins(line_items: :item)
160
- .where("line_items.item_id = ?", kit_item.id)
+ .where(line_items: { item_id: kit_item.id })
161
.sum('line_items.quantity / COALESCE(items.distribution_quantity, 1.0)')
162
163
total_assisted_adults.to_i / 12.0
0 commit comments