From 03963a47c74abd9c000e54531435f384c324d3ca Mon Sep 17 00:00:00 2001 From: "Charly C." Date: Tue, 10 Sep 2024 11:13:27 +0200 Subject: [PATCH] show advance amounts in team tables (#2454) This is a partial response to #2434, #2217 and other cases of confusion as to how team takes work. --- liberapay/models/_mixin_team.py | 3 ++- style/base/base.scss | 6 +++--- templates/macros/team-members.html | 10 ++++++++++ 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/liberapay/models/_mixin_team.py b/liberapay/models/_mixin_team.py index 75a075cd4..a798fedc2 100644 --- a/liberapay/models/_mixin_team.py +++ b/liberapay/models/_mixin_team.py @@ -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 @@ -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) diff --git a/style/base/base.scss b/style/base/base.scss index 5f4d36482..7bf4b8384 100644 --- a/style/base/base.scss +++ b/style/base/base.scss @@ -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; } diff --git a/templates/macros/team-members.html b/templates/macros/team-members.html index ad092527d..e7f57fa72 100644 --- a/templates/macros/team-members.html +++ b/templates/macros/team-members.html @@ -25,12 +25,20 @@ {{ _("Last Payday") }}
({{ locale.format_date(last_payday) if last_payday else _("n/a") }}) {{ _("Next Payday") }}
({{ locale.format_date(next_payday) }}) + {{ _("Member") }} {{ _("Nominal Take") }} {{ _("Nominal Take") }} {{ _("Actual Take") }} + {{ _("Advance") }} @@ -88,6 +96,7 @@ {{ '~' if fuzzy_take.fuzzy else '' }}{{ locale.format_money(fuzzy_take) }} + {{ locale.format_money(member.received_in_advance or nominal_take.zero()) }} % endfor @@ -104,6 +113,7 @@ %} title="{{ locale.format_money_basket(members.leftover) }}"{% endif %}>{{ '~' if fuzzy_leftover.fuzzy else '' }}{{ locale.format_money(fuzzy_leftover) }} +