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

History page: show tipper if it's a team you're a member of #2173

Merged
merged 3 commits into from
May 1, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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