diff --git a/branch.sql b/branch.sql new file mode 100644 index 0000000000..29dc386b3a --- /dev/null +++ b/branch.sql @@ -0,0 +1,24 @@ +BEGIN; + + ALTER TABLE transfers ADD COLUMN as_team_member boolean NOT NULL DEFAULT false; + + UPDATE transfers + SET as_team_member = true + WHERE amount <= ( + SELECT amount + FROM takes + WHERE takes.team = transfers.tipper + AND takes.member = transfers.tippee + AND takes.ctime < transfers.timestamp + ORDER BY takes.ctime DESC + LIMIT 1 + ) + AND amount != ( + SELECT amount + FROM tips + WHERE tips.ctime < transfers.timestamp + ORDER BY tips.ctime DESC + LIMIT 1 + ); + +END; diff --git a/gittip/billing/payday.py b/gittip/billing/payday.py index da901520fc..66a241f2f7 100644 --- a/gittip/billing/payday.py +++ b/gittip/billing/payday.py @@ -454,7 +454,7 @@ def transfer(self, tipper, tippee, amount, pachinko=False): return False self.credit_participant(cursor, tippee, amount) - self.record_transfer(cursor, tipper, tippee, amount) + self.record_transfer(cursor, tipper, tippee, amount, pachinko) if pachinko: self.mark_pachinko(cursor, amount) else: @@ -835,14 +835,14 @@ def record_credit(self, amount, fee, error, username): )) - def record_transfer(self, cursor, tipper, tippee, amount): + def record_transfer(self, cursor, tipper, tippee, amount, as_team_member=False): cursor.run("""\ INSERT INTO transfers - (tipper, tippee, amount) - VALUES (%s, %s, %s) + (tipper, tippee, amount, as_team_member) + VALUES (%s, %s, %s, %s) - """, (tipper, tippee, amount)) + """, (tipper, tippee, amount, as_team_member)) def mark_missing_funding(self): diff --git a/www/%username/history/index.html.spt b/www/%username/history/index.html.spt index 026fa37b0d..7d2cb3fc50 100644 --- a/www/%username/history/index.html.spt +++ b/www/%username/history/index.html.spt @@ -275,7 +275,7 @@ locked = False