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: improve deletion of test data #2473

Closed
Benunc opened this issue Dec 7, 2017 · 3 comments

Comments

Projects
None yet
4 participants
@Benunc
Copy link
Member

commented Dec 7, 2017

Issue Overview

Currently deleting the test data at Donations > Tools > Data (tab) deletes donations made when give is in test mode, but not donations made with the test gateway in live mode.

Expected Behavior

Test donations of all types should be deleted.

Current Behavior

Only donations that are made in test mode are deleted.

Possible Solution

Add a check for test gateway during the deletion process.
Related to this, it would be nice to "wipe the slate clean" of only donation data and NOT delete the forms. For when (for example) you want to delete all data but leave forms.

Steps to Reproduce (for bugs)

  1. Create donations in both test and live mode (payment gateways -> enabled/disabled) while using the test gateway.
  2. navigate to donations > tools > data (tab) and delete the Test payments
  3. navigate back to Donations > Donations
  4. only donations made while give is in test mode are deleted.

Acceptance Criteria

  • When Delete Test Donations is selected, it deletes all donations where _give_payment_mode === test (where test indicates any donation made while in Test Mode)
  • When Delete Test Donations is selected, it also deletes all donations where _give_payment_gateway === manual (where manual indicates a donation through the Test Donation gateway).
  • The description reads: Deletes all donations made in Test Mode and all donations made through the Test Donation gateway in Live Mode.
  • The same donations are deleted when Delete Test Donors and Donations is selected.

@DevinWalker DevinWalker added this to the 2.2 milestone Dec 11, 2017

@DevinWalker DevinWalker removed this from the 2.2 milestone Mar 6, 2018

@kevinwhoffman kevinwhoffman changed the title Deleting Test data should delete all donation made with test gateway. fix(admin-tool): improve deletion of test data Mar 12, 2018

@kakshak

This comment has been minimized.

Copy link
Member

commented Oct 11, 2018

@kevinwhoffman Actually, I am confused with this issue behavior. Because if a user selects Delete Test Donations from Donations > Tools > Data (tab) then it should delete the all the test donations NOT all(live + test) types of donations. It is intended behavior.

Please let me know your thoughts on this.

@kevinwhoffman kevinwhoffman changed the title fix(admin-tool): improve deletion of test data fix: improve deletion of test data Oct 11, 2018

@kevinwhoffman

This comment has been minimized.

Copy link
Member

commented Oct 11, 2018

Here's my understanding of what @Benunc is asking to delete when Delete Test Donations is selected:

  • All donations made through any gateway while Test Mode is enabled.
    • This means delete all donations where _give_payment_mode = test.
  • In addition, all donations made with the Test Donation gateway in Live mode.
    • This means delete all donations where _give_payment_gateway = manual.

Acceptance criteria have been updated accordingly.

@kevinwhoffman

This comment has been minimized.

Copy link
Member

commented Oct 11, 2018

@kakshak There are 2 queries that need modified. Add a meta query with 'relation' => 'OR' to look for either of the two meta keys as described above.

This query runs whenever Delete Test Donations is selected:

$args = apply_filters( 'give_tools_reset_stats_total_args', array(
'post_status' => 'any',
'number' => - 1,
'meta_key' => '_give_payment_mode',
'meta_value' => 'test'
) );

This query runs whenever Delete Test Donors and Donations is selected:

$args = apply_filters( 'give_tools_reset_stats_total_args', array(
'post_type' => 'give_payment',
'post_status' => 'any',
'posts_per_page' => $this->per_step,
'paged' => $paged,
// ONLY TEST MODE TRANSACTIONS!!!
'meta_key' => '_give_payment_mode',
'meta_value' => 'test',
) );

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.