-
Notifications
You must be signed in to change notification settings - Fork 308
repair paydays table #204
Comments
Here's how I fixed nparticipants:
In addition to the early issue where we were counting unclaimed accounts as registered users, it turns out that rerunning the paydays script throws this number off as well (#261). We got bit by that in week 7 (#169) but it wasn't enough to notice. We got bit by it again this week (#257) and it was enough to notice. :-) |
Am I missing something major here or is updating the exchange_volume (that's actually ach_volume, right?) as simple as: UPDATE paydays
SET ach_volume = (
SELECT count(amount)
FROM exchanges
WHERE timestamp > ts_start
AND timestamp < ts_end
AND amount < 0
); And the same for fees: UPDATE paydays
SET ach_fees_volume = (
SELECT count(fee)
FROM exchanges
WHERE timestamp > ts_start
AND timestamp < ts_end
AND amount < 0
); |
Following the self check #1705 idea I have select count(id)
from paydays
where charge_volume != (
select sum(amount+fee)
from exchanges
where timestamp > ts_start
and timestamp < ts_end
and amount > 0
) returning 0. |
There are two bugs in select * from (
select id, ts_start, charge_fees_volume, (
select sum(fee)
from exchanges
where timestamp > ts_start
and timestamp < ts_end
and amount > 0
) as ref
from paydays
order by id
) as foo
where charge_fees_volume != ref; returning 2 rows
|
There seems to be one bug in select * from (
select id, ts_start, ach_volume, (
select sum(amount)
from exchanges
where timestamp > ts_start
and timestamp < ts_end
and amount < 0
) as ref
from paydays
order by id
) as foo
where ach_volume != ref; returning
|
select * from (
select id, ts_start, ach_fees_volume, (
select sum(fee)
from exchanges
where timestamp > ts_start
and timestamp < ts_end
and amount < 0
) as ref
from paydays
order by id
) as foo
where ach_fees_volume != ref; Returns 0 rows. |
@whit537 Is it worth to start looking for a bugs in the payday code or do we just fix it for now, add it to the self checks and wait for it to break? That would be my suggestion. |
Agreed, add it to self-checks and wait for it to break. Once we're comfortable with web app db usage we'll turn our attention to payday. |
Reviewing this again w/ the PR (#1902) ... can we trace the problem to the bugs on #202? We may not have to go debugging anew, we should have the answer right there on #202. At first glance the dates in #204 (comment) seem like they could be Gittip <= 8 as the description on this ticket states. I'm not sure about #204 (comment). Was there another payday failure around that time that accounts for the corruption in ach_volume? |
None of the problems are Gittip <= 8 (see the |
Right. I was suggesting that the bugs might already have been discovered, on #202 ...
... but it sounds like they weren't. So our decision holds. :-) |
I am confused. Are we merging #1902 and closing this issue or do we want to do something else? |
We're merging. :-) IRC |
Repair paydays and add self checks (fixes #204).
This isn't really used much yet but it should be (nice historical data). Two repairs needed:
recalculate nparticipants for paydays <= Allow for optional advertisement of tipping #3The text was updated successfully, but these errors were encountered: