awesomemotive / easy-digital-downloads

Sell digital downloads through WordPress
https://easydigitaldownloads.com
GNU General Public License v2.0
863 stars 474 forks source link

Sales number after deleting a payment #8114

Open Codevz opened 3 years ago

Codevz commented 3 years ago

Bug Report

When I delete a payment, number of all sales in downloads don't re-calculate and still showing old number.

Information (if a specific version is affected):

PHP Version: 7.2+

EDD Version (or branch): 2.9.25

WordPress Version: 5.5.1

cklosowski commented 3 years ago

What 'number of sales' count are you referring to? Keep in mind that some of these are stored in cache for a short time in order to make the dashboard load more quickly and will be updated when the cache is expired.

Codevz commented 3 years ago

Sorry I mean when I delete failed payment, in admin downloads page sales number and earnings of product will decrease. for e.g.

ashleyfae commented 3 years ago

Sorry if I'm missing something obvious, but it does look like it has recalculated correctly? The first screenshot shows 3451 sales and the last one shows 3450 (minus one, and the earnings have gone down by $39).

In your initial report you said it's not recalculating. But in the screenshot you've showed, the numbers have decreased.

The screenshots you provided show what did happen; could you perhaps explain what you expect to happen instead?

Codevz commented 3 years ago

I'm sure there is a problem in EDD but I don't know why this happens. I have recorded sample video to show you the problem. Please check out video here: https://vimeo.com/462082865

For test:

cklosowski commented 3 years ago

Thanks for the steps @Codevz So the key to replicating is refunding a payment, and then deleting a payment, thinking the action is taken twice on the same payment to reduce stats.

Can you confirm if you go to the Downloads > Tools page and recalculate the stats for that specific product, if the download now has the proper stats on it? I only ask this to make sure that it's a processing error instead of an actual data error in the database. If what I think is happening, is happening, we're just possibly running the same calculation twice when it should only be run once, but the data for proper stats are still in tact, if we recalculate.

Codevz commented 3 years ago

I confirm Downloads > Tools > Recount Earnings and Sales for a download did it and download item now showing 1 sale, Thanks for your attention.

Codevz commented 3 years ago

On our online site, Just found a new problem with number of sales and number of completed payments after Recount Earnings and Sales for all downloads

But its wrong, because some of payments quantities are different, for example 170 of completed payments are 3 quantity and number of sales should be 2596 but its 2256

In recalculating procedure EDD should calculate number of quantity of each completed payments as number of sales in download item.