Skip to content

Children served not calculated correctly if there are kits #4915

Closed
@cielf

Description

@cielf

Summary

The children served number is not including children served with kits appropriately

Why fix?

Consistency. Corrextness.

Details

Regarding the Annual Survey
This method:
def children_served_with_kits_containing_disposables
organization
.distributions
.for_year(year)
.joins(line_items: {item: :kit})
.merge(Item.disposable)
.where.not(items: {kit_id: nil})
.distinct
.count("kits.id")
end

counts kits that are disposables (which will be 0), not kits that have disposables

Fix it.

(You probably shouldn't take this one unless you are familiar with both the annual survey and kits. And you might need to do SQL for this. So it's a little advanced)

Criteria for completion

  • behaviour as decribed
  • tests to confirm the behaviour

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions