KEMBAR78
filters archived children from children_served_count by john-huang-121 · Pull Request #5265 · rubyforgood/human-essentials · GitHub
Skip to content

Conversation

john-huang-121
Copy link
Contributor

@john-huang-121 john-huang-121 commented Jul 3, 2025

Resolves #5246

Description

Previously 'Children served' is just a total count of Children. This change addresses that children whom are archived no longer counts towards 'Children served'

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Sign in as org_admin1@example.com
Click Partner Agencies, then "All Partners"
Click on "Pawnee Parent Service"
Note the number of children served is shown in the second section.
Sign out.

Sign in as verified@example.com
Click on Children in the left hand menu
Choose a child and "Edit Child Details"
Check the archived checkbox and update child.

Log back into the admin and check that the number went down by 1.

Screenshots

Before:
Screenshot 2025-07-02 at 11 37 11 PM

After:
Screenshot 2025-07-02 at 11 36 51 PM
Screenshot 2025-07-02 at 11 36 31 PM

@john-huang-121
Copy link
Contributor Author

I'd add the in-progress label, but it won't let me make edits labels.

@cielf
Copy link
Collaborator

cielf commented Jul 3, 2025

It being in draft suffices to tell us not to review yet.

@john-huang-121
Copy link
Contributor Author

Double checked that the children_served_count is only called in impact_metrics.

@john-huang-121 john-huang-121 marked this pull request as ready for review July 3, 2025 22:27
@cielf
Copy link
Collaborator

cielf commented Jul 4, 2025

Over to @dorner for technical review

@cielf cielf requested a review from dorner July 4, 2025 14:40
Copy link
Collaborator

@dorner dorner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lint is failing - suggestion given above.


def children_served_count
children.count
children.reject { |child| child.archived? }.count
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
children.reject { |child| child.archived? }.count
children.count(&:archived?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I use this change it is the opposite of what we want. Let me check
children.count { |child| !child.archived? }

@john-huang-121 john-huang-121 force-pushed the 5246-remove-archived-children-from-count branch from 49ef211 to 2a63571 Compare July 6, 2025 02:01
@john-huang-121
Copy link
Contributor Author

Should pass linter now.

@john-huang-121 john-huang-121 requested a review from dorner July 6, 2025 02:02
@dorner dorner merged commit 4ff9bad into rubyforgood:main Jul 11, 2025
11 checks passed
@github-actions
Copy link
Contributor

@john-huang-121: Your PR filters archived children from children_served_count is part of today's Human Essentials production release: 2025.07.13.
Thank you very much for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Number of children served -- should not include archived children.

3 participants