Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor: Simplify goal data to use query builder directly #7385

Merged

Conversation

kjohnson
Copy link
Member

@kjohnson kjohnson commented May 6, 2024

Instead of supporting new repository methods, this PR simplifies the goal data to use the new DonationQuery directly.

Description

I noticed that each update required a check for all-time vs custom and then an additional *ForDateRange() method. This instantiates the query and conditionally sets the start/end values.

Each type of value then completes the query.

GoalType::DONATIONS() calls $query->count().
GoalType::DONORS() calls $query->countDonors().
GoalType::AMOUNT() calls $query->sumIntendedAmount().

@kjohnson kjohnson requested a review from alaca May 6, 2024 21:21
@kjohnson kjohnson changed the base branch from develop to epic/time-based-form-goals-GIVE-565 May 6, 2024 21:22
@kjohnson kjohnson marked this pull request as ready for review May 6, 2024 21:31
Copy link
Member

@alaca alaca left a comment

Choose a reason for hiding this comment

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

Looks good 👍

@kjohnson kjohnson merged commit db868ad into epic/time-based-form-goals-GIVE-565 May 7, 2024
20 checks passed
@kjohnson kjohnson deleted the refactor/goal-data-query-builder branch May 7, 2024 13:08
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.

2 participants