generated from coulomb/repo-seed
Adapt economics dashboard to sole-member zero-cost reality
Update membership, revenue, and cost registries to one active member with no running costs. Refresh dashboard report and tests for €8.99 revenue and 100% gross margin.
This commit is contained in:
@@ -17,10 +17,10 @@ DATA_DIR = Path(__file__).resolve().parent.parent / "data"
|
||||
|
||||
def test_active_members_counts_only_active_status() -> None:
|
||||
members = load_membership(DATA_DIR)
|
||||
assert active_members(members) == 3
|
||||
assert active_members(members) == 1
|
||||
|
||||
|
||||
def test_build_snapshot_uses_seed_revenue_for_period() -> None:
|
||||
def test_build_snapshot_reflects_sole_member_and_zero_costs() -> None:
|
||||
product = load_product(DATA_DIR)
|
||||
models = load_pricing_models(DATA_DIR)
|
||||
members = load_membership(DATA_DIR)
|
||||
@@ -29,23 +29,20 @@ def test_build_snapshot_uses_seed_revenue_for_period() -> None:
|
||||
|
||||
snapshot = build_snapshot("2026-06", product, models, members, revenue, costs, fx_rates)
|
||||
|
||||
assert snapshot.active_members == 3
|
||||
assert snapshot.monthly_revenue == Decimal("80.91")
|
||||
assert snapshot.revenue_source == "manual_estimate"
|
||||
assert snapshot.active_members == 1
|
||||
assert snapshot.monthly_revenue == Decimal("8.99")
|
||||
assert snapshot.revenue_source == "manual"
|
||||
assert snapshot.pricing_model_count == 3
|
||||
assert snapshot.monthly_cost > Decimal("0")
|
||||
assert snapshot.cost_per_member == (snapshot.monthly_cost / 3).quantize(Decimal("0.01"))
|
||||
assert snapshot.gross_margin == (snapshot.monthly_revenue - snapshot.monthly_cost).quantize(
|
||||
Decimal("0.01")
|
||||
)
|
||||
assert snapshot.monthly_cost == Decimal("0.00")
|
||||
assert snapshot.cost_per_member == Decimal("0.00")
|
||||
assert snapshot.gross_margin == Decimal("8.99")
|
||||
assert snapshot.gross_margin_pct == Decimal("100.0")
|
||||
|
||||
|
||||
def test_monthly_cost_includes_fixed_and_variable_components() -> None:
|
||||
def test_monthly_cost_is_zero_with_empty_registry() -> None:
|
||||
_, costs, fx_rates = load_costs(DATA_DIR)
|
||||
total = monthly_cost_total(costs, fx_rates, Decimal("80.91"), 3)
|
||||
# fixed: 35 USD -> 32.20 EUR + 15 EUR + 25 EUR = 72.20
|
||||
# variable: 1.5% of 80.91 + 0.25 * 3 = 1.21 + 0.75 = 1.96
|
||||
assert total == Decimal("74.16")
|
||||
total = monthly_cost_total(costs, fx_rates, Decimal("8.99"), 1)
|
||||
assert total == Decimal("0.00")
|
||||
|
||||
|
||||
def test_dashboard_module_renders_markdown() -> None:
|
||||
@@ -54,4 +51,5 @@ def test_dashboard_module_renders_markdown() -> None:
|
||||
report = generate_dashboard(DATA_DIR, "2026-06")
|
||||
assert "# Economics Dashboard v1" in report
|
||||
assert "Pricing Model Registry" in report
|
||||
assert "flat-899-eur-monthly" in report
|
||||
assert "flat-899-eur-monthly" in report
|
||||
assert "Active members | 1" in report
|
||||
Reference in New Issue
Block a user