Repository: gratipay/gratipay.com

Issue:
receipts as member of team shouldn't be anon
On the history page we should show when you receive money from a team (reticketed from #1118).



Discussion:
![history](https://f.cloud.github.com/assets/2024776/761743/0ab1a94e-e7da-11e2-889a-a73cddc6580d.jpg)

$.25 from Someone should say Team-Name instead

:blush:

+1 from @pjz in [IRC](https://botbot.me/freenode/gittip/msg/5386986/).

@whit537 mind if I take this on?

Browsing through the codebase, it seems like [this code](https://github.com/gittip/www.gittip.com/blob/3e4d695baea21cce527f31106f506dadbe5ddee3/www/%25username/history/index.html.spt#L271-L275) could be changed to:

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

Could you explain this bit of code?

``` py
    def show_as_team(self, user):
        """Return a boolean, whether to show this participant as a team.
        """
        if not self.IS_PLURAL:
            return False
        if user.ADMIN:
            return True
        if not self.get_members():
            if self != user:
                return False
        return True
```

Specifically, the last condition. What does `self != user` mean in this context?

I think some documentation on the schema of payday/transfers/exchanges would make this type of issue (especially generating tests) easier.

Do we need to JOIN the `participants` table to the `transfers` on `transfers.tipper == participants.usename` and decide based on `participants.number`?

BTW: I have no idea what either of the `if`s does (the template or the code).

I got re-annoyed at this and wrote code using @zwn 's suggested method... but is a simple test of number!='singular'  enough? or do we need to also make sure that the user is a member of the non-singular tipper ?

Perusing the [blog post](http://blog.gittip.com/post/74460469599), I started [watching one of the videos](http://youtu.be/_Lz6S7OmbGI?t=51m22s), where @pjz was frustrated that no one responded to this particular ticket. Honestly, so was I. @whit537 I understand that you're constantly being pulled in many different directions, but when questions are never answered, our volunteer efforts stall. If no one cares to answer, what's the point?

At 1:02:XX we discussed the idea that it's that person's responsibility to ping specific people if they need input or assistence. Quoting @whit537 out of context:

> If you don't ping somebody, it's your fault.

---

Either way, we should really have a bi-weekly stand-up meeting if we can find a good time for most people. I think having human contact will help a lot.

@seanlinsley I'm fine with scheduling a regular Hangout. Let's move this conversation over to #1943 ...

@whit537 , @zwn is a simple test of number!='singular' enough? or do we need to also make sure that the user is a member of the non-singular tipper ?

We are showing this in the history view of the profile. What am I (as the user) expecting to see?
- When I am a member of a team and set my own take, I am entitled to see the transfer resulting from that. 
- I think I should see that transfer in the history view even when I am not a member of that team anymore. 
- Actually, I think I should see the transfer even it the team is not a team anymore.

So what would be the best technical solution? I think that marking somehow the transfer is the only way (in the end). Checking if the giver is a team **right now** is good compromise. The only strange thing is that if the giver was singular and was tipping me in the past, switching to a team would mean all the past tips would be revealed to me.

> The only strange thing is that if the giver was singular and was tipping me in the past, switching to a team would mean all the past tips would be revealed to me.

I hadn't considered that. Maybe we should store the singular/plural information on the tip itself.

> Maybe we should store the singular/plural information on the tip itself.

I think it needs to be on the transfer not on the tip (actually it is not a tip, it is a different table).

That's what I meant -- I'm not that familiar with the database :sweat_smile: 

+1


Resolving patch:
diff --git a/gittip/billing/payday.py b/gittip/billing/payday.py
--- 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):


Test patch: