Add StatisticsLive: overview, bars by year, pie chart

- Summary cards: active/inactive members, open amount
- Joins and exits by year (horizontal bars)
- Contributions by year: table with stacked bar above amounts
- Column order: Paid, Unpaid, Suspended, Total; color dots for legend
- All years combined pie chart
- LiveView tests
This commit is contained in:
Moritz 2026-02-10 22:31:40 +01:00 committed by moritz
parent 919a8e4ebd
commit 6e309622a0
2 changed files with 530 additions and 0 deletions

View file

@ -0,0 +1,32 @@
defmodule MvWeb.StatisticsLiveTest do
@moduledoc """
Tests for the Statistics LiveView at /statistics.
"""
use MvWeb.ConnCase, async: true
import Phoenix.LiveViewTest
describe "statistics page" do
test "renders statistics page with title and key labels for authenticated user with access",
%{
conn: conn
} do
{:ok, _view, html} = live(conn, ~p"/statistics")
assert html =~ "Statistics"
assert html =~ "Active members"
assert html =~ "Open amount"
assert html =~ "Contributions by year"
assert html =~ "Joins and exits by year"
end
test "page shows overview of all relevant years without year selector", %{conn: conn} do
{:ok, _view, html} = live(conn, ~p"/statistics")
# No year dropdown: single select for year should not be present as main control
assert html =~ "Overview" or html =~ "overview"
# table header or legend
assert html =~ "Year"
end
end
end