Skip to content

Commit

Permalink
feat: display synthetic costs in outstanding report (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
tructn committed Nov 27, 2024
1 parent 4b971cf commit 3b9a240
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions frontend/src/screens/reporting/outstanding-payments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ export default function OutstandingPayments() {
<Table.Tr>
<Table.Th>Name</Table.Th>
<Table.Th>Unpaid Amount</Table.Th>
<Table.Th>Matches</Table.Th>
<Table.Th>Summary</Table.Th>
<Table.Th>Attendant Count</Table.Th>
<Table.Th>Synthetic Costs</Table.Th>
<Table.Th></Table.Th>
</Table.Tr>
</Table.Thead>
Expand Down
3 changes: 2 additions & 1 deletion internal/service/reporting.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,11 @@ func (s *ReportingService) GetUnpaidReport() ([]UnpaidByPlayer, error) {
GROUP BY m.id, m.sport_center_id, acx.additional_cost
),
cte_registration_history AS (
SELECT p.id AS player_id, STRING_AGG(TO_CHAR(m.start, 'DD-Mon'), ', ' ORDER BY m.start) AS registration_summary
SELECT p.id AS player_id, STRING_AGG('£' ||ROUND(mc.individual_cost, 2) || '(' || TO_CHAR(m.start, 'DD.Mon') || ')', ' + ' ORDER BY m.start) AS registration_summary
FROM registrations r
JOIN matches m ON m.id = r.match_id
JOIN players p on p.id = r.player_id
JOIN cte_match_costs mc ON m.id = mc.match_id
WHERE r.is_paid = false
GROUP BY p.id
)
Expand Down

0 comments on commit 3b9a240

Please sign in to comment.