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: check if the form goal is enabled before calling the goal stats function in the GetAsyncFormDataForListView class #7676

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

glaubersilva
Copy link
Contributor

@glaubersilva glaubersilva commented Jan 15, 2025

Resolves GIVE-2085

Description

This PR changes how the async approach to load form data in the form list table works. Now, instead of calling the give_goal_progress_stats() for all forms, it calls only for the forms that have the goal option enabled.

Affects

The "All Forms" list table

Testing Instructions

This code is not directly responsible for the "Division by zero" error related to this other PR, but the changes implemented here can indirectly fix the same problem.

So, to test these changes, you can use the develop branch of the Fee Recovery add-on and follow the same test instructions from this PR: https://github.com/impress-org/give-fee-recovery/pull/341

Pre-review Checklist

  • Acceptance criteria satisfied and marked in related issue
  • Relevant @unreleased tags included in DocBlocks
  • Includes unit tests
  • Reviewed by the designer (if follows a design)
  • Self Review of code and UX completed

@glaubersilva glaubersilva self-assigned this Jan 15, 2025
@glaubersilva glaubersilva marked this pull request as ready for review January 15, 2025 19:49
private function isFormGoalEnabled(int $formId): bool
{
return give_is_setting_enabled(Give()->form_meta->get_meta($formId,
DonationFormMetaKeys::GOAL_OPTION()->getKeyAsCamelCase(), true));
Copy link
Contributor

Choose a reason for hiding this comment

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

Since this meta is v2 backwards compatible, we may also want to optionally check for the v3 flag specifically:

$donationForm->settings->enableDonationGoal

@pauloiankoski pauloiankoski removed their request for review January 20, 2025 15:14
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