Repository: liberapay/liberapay.com

Issue:
The "Stats" page needs to be adapted
On [the stats page](https://en.liberapay.com/about/stats), it's written "_€23,253.40 and $2,630.25 is escrowed within Liberapay._" which can give the impression that those >23k€ and >2k$ are stocked/blocked **in** liberapay.

I'm not too sure about the reality of this. It can well be the case if that amount of money is what's left in the different mangopay users wallets but it seems to me like a big amount. Then, I'm thinking that it might probably be a figure of the money which have been given by donors to receivers for the next weeks/months to come.

In the case I'm right with the second hypothesis, I'd suggest another wording such as "_In Liberapay, donors are actually giving 23 253,40 € and 2 630,25 $US on the weeks to come._"

_(BTW, there is no mention of the few PLN which have starting to come on last payday, yesterday)_



Discussion:
I thought this was Mangopay wallets?

> escrow = db_qc5.one("SELECT basket_sum(balance) FROM wallets") or MoneyBasket()
> ...
> <p>{{ _("{0} is escrowed within Liberapay.", escrow) }}</p>

From https://github.com/liberapay/liberapay.com/blob/33f5a0ad0b01e90fba63e90f5adac65bf24082e9/www/about/stats.spt#L13
Yes, it's the amount of money still stuck in Mangopay wallets. We haven't sent explicit notifications to users who still have money in their wallets, and we need to add an option to donate that money to Liberapay for when there isn't enough of it to withdraw to a bank account. Another option to send the funds to a PayPal account would also be helpful, because international bank transfers suck and Mangopay doesn't support all countries.
OK. So the first impression (ie: the money is stocked in LP) is the right one.
Thanks for the clear explanation. Closing then.
I don't think this is resolved, because it is a little confusing to mention "escrow" on that page but not anywhere else. If the money is not being used (and can't be used to fund anyone through Liberapay at the moment), the escrow amounts should probably be removed to reduce confusion. They don't currently add useful information for users.

At this point, the escrow amounts should be more of an admin dashboard tool to show how much money still needs to get moved out of Mangopay and back to users.
Fair point, reopening then.

Resolving patch:
diff --git a/liberapay/billing/payday.py b/liberapay/billing/payday.py
--- a/liberapay/billing/payday.py
+++ b/liberapay/billing/payday.py
@@ -813,6 +813,13 @@ def update_stats(cls, payday_id):
                         WHERE amount < 0
                           AND refunded
                    )
+                 , week_payins = (
+                       SELECT basket_sum(pi.amount)
+                         FROM payins pi
+                        WHERE pi.ctime < %(ts_start)s
+                          AND pi.ctime >= %(previous_ts_start)s
+                          AND pi.status = 'succeeded'
+                   )
              WHERE id = %(payday_id)s
 
         """, locals())


Test patch:
diff --git a/tests/py/test_charts_json.py b/tests/py/test_charts_json.py
--- a/tests/py/test_charts_json.py
+++ b/tests/py/test_charts_json.py
@@ -147,8 +147,7 @@ def test_transfer_volume(self):
             "nactive": '3',
             "nparticipants": '5',
             "nusers": '4',
-            "week_deposits": zero,
-            "week_withdrawals": zero,
+            "week_payins": zero,
         }
         actual = json.loads(self.client.GET('/about/charts.json').text)[0]
         assert actual == expected