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

Fix: provide fallback for donation mode during model queries #7097

Merged
merged 6 commits into from
Dec 5, 2023

Conversation

jonwaldstein
Copy link
Contributor

@jonwaldstein jonwaldstein commented Nov 10, 2023

Resolves #7096 GIVE-27

Description

This resolves an issue where in some cases the donation mode was not stored in the database and the donation model query was causing an error from expecting a value. This is most notable on the admin list table. The simplest way to resolve this is to have a static fallback which was updated in this PR.

Typically we would create a migration for missing data that is expected, but this is unique in that we would have no way of knowing what the actual donation mode was at the time of creation. Furthermore, in terms of backwards compatibility - this could be a persistent issue from a third party add-on that intercepts or modifies the donation. So the safest and simplest option is just to have a static fallback value of "live" as that is always the assumption unless specifically defined as "test".

For clarity, in GiveWP 3.0+ forms, we are confident that the payment mode is always stored.

Affects

  • The donation list table when payment mode meta is missing

Visuals

N/A

Testing Instructions

  • Create a donation without a payment mode
  • View the list table and make sure it shows up properly

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

@jonwaldstein jonwaldstein marked this pull request as ready for review November 27, 2023 17:40
@JasonTheAdams
Copy link
Contributor

@jonwaldstein Should we also have the Subscription model fallback on live mode?

@jonwaldstein
Copy link
Contributor Author

@jonwaldstein Should we also have the Subscription model fallback on live mode?

I think that would be proactively wise. Although, I would open a separate PR for that.

Luckily the subscription table has a payment_mode column so adjusting the list table query (if need be) should be simpler.

@jonwaldstein
Copy link
Contributor Author

@JasonTheAdams this is ready for review.

Copy link
Contributor

@JasonTheAdams JasonTheAdams 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!

Copy link
Member

@rickalday rickalday left a comment

Choose a reason for hiding this comment

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

Passed manual QA tests.

@jonwaldstein jonwaldstein changed the base branch from master to develop December 5, 2023 17:15
@jonwaldstein jonwaldstein changed the base branch from develop to master December 5, 2023 17:29
@jonwaldstein jonwaldstein changed the base branch from master to develop December 5, 2023 17:30
@jonwaldstein jonwaldstein force-pushed the fix/donation-mode-query branch from ae94985 to a6d2247 Compare December 5, 2023 18:06
@jonwaldstein jonwaldstein merged commit 4f7eabe into develop Dec 5, 2023
28 of 40 checks passed
@jonwaldstein jonwaldstein deleted the fix/donation-mode-query branch December 5, 2023 22:05
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.

On certain conditions, the Donations > Donations page will display a fatal error
4 participants