Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Fix payday #2374

Merged
merged 12 commits into from
May 15, 2014
Merged

Fix payday #2374

merged 12 commits into from
May 15, 2014

Conversation

Changaco
Copy link
Contributor

@Changaco Changaco commented May 9, 2014

Make it possible to restart payday when it fails in the middle of pachinko, without creating duplicate transfers. #2362

@@ -258,7 +258,32 @@ def tip(tippee, amount):
, pachinko=True
)

for take in participant.get_current_takes():
takes = self.db.all("""
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it'd be good to have a comment explaining this query in the code

@@ -235,10 +235,10 @@ def payin(self, ts_start, participants):

def pachinko(self, ts_start, participants):
i = 0
for i, (participant, foo, bar) in enumerate(participants, start=1):
Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, I see: we are ignoring tips and transfers anyway in the pachinko loop.

Copy link
Contributor

Choose a reason for hiding this comment

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

So we don't need to use genparticipants to knit those into the result of get_participants.

chadwhitacre and others added 8 commits May 14, 2014 18:09
 - Add a for_payday parameter to get_current_takes, on the pattern of
   Participant.get_tips_and_total. I believe this adequately reproduces
   the semantics of the inline takes query currently on the fix-payday
   branch.

 - Teach genparticipants about the different loops, harmonizing the
   semantics of that generator in the various loop cases. Now it knits
   in different extra info based on the loop: tips and total for
   payin/payout, takes for pachinko.

My goal here is to provide a consistent implementation of the several
payday loops.
Now that get_takes takes a for_payday its no longer necessarily
*current* takes. Calling it get_takes harmonizes better with
get_tips_and_total.
It's no longer true (if it ever was) that we see new tips and takes when
rerunning payday after a crash.
Simplify SQL construction.
@chadwhitacre chadwhitacre mentioned this pull request May 15, 2014
refactor the fix for duplicate pachinko transfers
chadwhitacre added a commit that referenced this pull request May 15, 2014
@chadwhitacre chadwhitacre merged commit f3daf9c into master May 15, 2014
@chadwhitacre chadwhitacre deleted the fix-payday branch May 15, 2014 12:25
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants