diff --git a/data/finances.json b/data/finances.json index 0e66932..2b2b7d5 100644 --- a/data/finances.json +++ b/data/finances.json @@ -4,15 +4,14 @@ "Membership Fees": { "EUR": 365 }, - "Donations": {}, "Server Costs": { "EUR": -216.57 }, "Domain Names": {}, - "Operating Expenses": { - "EUR": -36.10 - }, - "Conversions": {} + "Administrative Expenses": { + "EUR": -36.10, + "Notes": "Administrative fee for the formation of the association" + } }, "5": { "Membership Fees": { @@ -23,11 +22,9 @@ "XMR": 0.447661805527 }, "Server Costs": { - "EUR": -430.04 - }, - "Domain Names": {}, - "Operating Expenses": {}, - "Conversions": {} + "EUR": -430.04, + "Notes": "Includes setup costs and two monthly payments for new server" + } }, "6": { "Server Costs": { diff --git a/helpers/finances.py b/helpers/finances.py index e4a0b32..b55111f 100644 --- a/helpers/finances.py +++ b/helpers/finances.py @@ -9,6 +9,7 @@ def get_latest_month(data): return int(latest_month), int(latest_year) + def get_transparency_data(data, year=None, month=None): if year is None: year = max(data.keys()) @@ -23,6 +24,7 @@ def get_transparency_data(data, year=None, month=None): balances = {} incomes = {} expenses = {} + notes = {} start_balance = {} end_balance = {} @@ -37,41 +39,51 @@ def get_transparency_data(data, year=None, month=None): # If the month is the one we are interested in, capture the start balance if int(y) == int(year) and int(m) == int(month): - start_balance = {k: Decimal(v) for k, v in balances.items()} + start_balance = { + k: Decimal(v) for k, v in balances.items() if k != "Notes" + } for category in data[y][m]: for currency, amount in data[y][m][category].items(): - if currency not in balances: - balances[currency] = Decimal(0) - balances[currency] += Decimal(str(amount)) + if currency == "Notes": + if int(y) == int(year) and int(m) == int(month): + notes[category] = amount + else: + if currency not in balances: + balances[currency] = Decimal(0) + balances[currency] += Decimal(str(amount)) - # Track incomes and expenses - if int(y) == int(year) and int(m) == int(month): - if Decimal(str(amount)) > 0: - if category not in incomes: - incomes[category] = {} - if currency not in incomes[category]: - incomes[category][currency] = Decimal(0) - incomes[category][currency] += Decimal(str(amount)) - else: - if category not in expenses: - expenses[category] = {} - if currency not in expenses[category]: - expenses[category][currency] = Decimal(0) - expenses[category][currency] += Decimal(str(amount)) + # Track incomes and expenses + if int(y) == int(year) and int(m) == int(month): + if Decimal(str(amount)) > 0: + if category not in incomes: + incomes[category] = {} + if currency not in incomes[category]: + incomes[category][currency] = Decimal(0) + incomes[category][currency] += Decimal(str(amount)) + else: + if category not in expenses: + expenses[category] = {} + if currency not in expenses[category]: + expenses[category][currency] = Decimal(0) + expenses[category][currency] += Decimal(str(amount)) # If the month is the one we are interested in, capture the end balance if int(y) == int(year) and int(m) == int(month): - end_balance = {k: Decimal(v) for k, v in balances.items()} + end_balance = { + k: Decimal(v) for k, v in balances.items() if k != "Notes" + } # Calculate accumulated sums of incomes and expenses accumulated_incomes = { currency: sum(incomes[cat].get(currency, Decimal(0)) for cat in incomes) for currency in balances + if currency != "Notes" } accumulated_expenses = { currency: sum(expenses[cat].get(currency, Decimal(0)) for cat in expenses) for currency in balances + if currency != "Notes" } return { @@ -81,6 +93,7 @@ def get_transparency_data(data, year=None, month=None): "expenses": expenses, "accumulated_incomes": accumulated_incomes, "accumulated_expenses": accumulated_expenses, + "notes": notes, } @@ -94,7 +107,7 @@ def generate_transparency_table(result, currencies=None): + list(data["accumulated_incomes"].keys()) + list(data["accumulated_expenses"].keys()) ) - - {"EUR"} + - {"EUR", "Notes"} ) ) @@ -152,7 +165,8 @@ def generate_transparency_table(result, currencies=None): # Add income rows for category, transactions in result["incomes"].items(): - html += f"
Notes:
" + html += "+ Want to know how we got here? Check out all of our + transparency reports for more + information. +
diff --git a/templates/transparency.html b/templates/transparency.html new file mode 100644 index 0000000..59626c2 --- /dev/null +++ b/templates/transparency.html @@ -0,0 +1,25 @@ +{% extends "base.html" %} {% block title %}Membership / Donations{% endblock %} +{% block content %} ++ Private.coffee is funded by its members and donations. We believe in + transparency and accountability. Below you can find financial reports for + each month since our inception. +
+