Skip to content

Commit

Permalink
show advance amounts in team tables (#2454)
Browse files Browse the repository at this point in the history
This is a partial response to #2434, #2217 and other cases of confusion as to how team takes work.
  • Loading branch information
Changaco authored Sep 10, 2024
1 parent 66a578c commit 03963a4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
3 changes: 2 additions & 1 deletion liberapay/models/_mixin_team.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def get_current_takes_for_display(self, cursor=None):
TAKES = """
SELECT p.id AS member_id, p.username AS member_name, p.avatar_url
, p.is_suspended
, t.amount, t.actual_amount, t.ctime, t.mtime
, t.amount, t.actual_amount, t.ctime, t.mtime, t.paid_in_advance
FROM current_takes t
JOIN participants p ON p.id = member
WHERE t.team=%(team)s
Expand Down Expand Up @@ -347,6 +347,7 @@ def get_members(self):
member['username'] = take['member_name']
member['nominal_take'] = take['amount']
member['actual_amount'] = take['actual_amount']
member['received_in_advance'] = take['paid_in_advance']
member['last_week'] = last_week.get(m_id)
if compute_max:
x = self.compute_max_this_week(m_id, last_week, take['amount'].currency)
Expand Down
6 changes: 3 additions & 3 deletions style/base/base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -687,12 +687,12 @@ table.team {
}
th, td {
&:not(:first-child) {
border-left: 1px dashed #ddd;
}
&:nth-child(2), &:nth-child(3) {
border-left: 2px solid #ddd;
}
}
tr:nth-child(2) > th:nth-child(4), td:nth-child(4) {
border-left: 1px dashed #ddd;
}
td:first-child {
min-width: 12em;
}
Expand Down
10 changes: 10 additions & 0 deletions templates/macros/team-members.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,20 @@
<th></th>
<th>{{ _("Last Payday") }}<br><small>({{ locale.format_date(last_payday) if last_payday else _("n/a") }})</small></th>
<th colspan=2>{{ _("Next Payday") }}<br><small>({{ locale.format_date(next_payday) }})</small></th>
<th></th>
</tr>
<tr>
<th>{{ _("Member") }}</th>
<th>{{ _("Nominal Take") }}</th>
<th>{{ _("Nominal Take") }}</th>
<th>{{ _("Actual Take") }}</th>
<th><span class="help-title" data-toggle="tooltip" data-placement="top" title="{{ _(
'On Liberapay, donations are paid in advance. This column '
'shows how much money each member has received in advance '
'through this team. An advance increases every time a member '
'receives a new payment from a donor through the team, and '
'decreases every week during “payday”.'
) }}">{{ _("Advance") }}</span></th>
</tr>
</thead>
<tbody>
Expand Down Expand Up @@ -88,6 +96,7 @@
<td{% if fuzzy_take.fuzzy %} title="{{ locale.format_money_basket(member.actual_amount) }}"{% endif %}>{{
'~' if fuzzy_take.fuzzy else '' }}{{ locale.format_money(fuzzy_take)
}}</td>
<td>{{ locale.format_money(member.received_in_advance or nominal_take.zero()) }}</td>
</tr>
% endfor
<tr class="leftover">
Expand All @@ -104,6 +113,7 @@
%} title="{{ locale.format_money_basket(members.leftover) }}"{% endif %}>{{
'~' if fuzzy_leftover.fuzzy else '' }}{{ locale.format_money(fuzzy_leftover)
}}</td>
<td></td>
</tr>
</tbody>
</table>
Expand Down

0 comments on commit 03963a4

Please sign in to comment.