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

Commit

Permalink
Merge pull request #2173 from gittip/1126-show-teams-on-history-page
Browse files Browse the repository at this point in the history
History page: show tipper if it's a team you're a member of
  • Loading branch information
Changaco committed May 1, 2014
2 parents ed3188d + e87e72b commit efb844d
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 6 deletions.
24 changes: 24 additions & 0 deletions branch.sql
Original file line number Diff line number Diff line change
@@ -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;
10 changes: 5 additions & 5 deletions gittip/billing/payday.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion www/%username/history/index.html.spt
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ locked = False
<td class="balance">{{ event['balance'] }}</td>

{% if event['tippee'] == participant.username %}
{% if user.ADMIN and (participant != user.participant or 'override' in qs) %}
{% if event['as_team_member'] or user.ADMIN and (participant != user.participant or 'override' in qs) %}
<td class="notes">from <a href="/{{ event['tipper'] }}/history/">{{ event['tipper'] }}</a></td>
{% else %}
<td class="notes">from someone</td>
Expand Down

0 comments on commit efb844d

Please sign in to comment.