a python script transforming boring spreadsheets into a glittery webpage
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

121 lines
3.5 KiB

<!DOCTYPE html>
<html lang="en">
<head>
<title>Varia's Common Fun(d)</title>
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
</head>
<body>
<h1>Varia's Common Fun(d) - <span style="color:magenta;">{{ year }}</span></h1>
<table>
<thead>
</thead>
<tbody>
{% set check = namespace(color=False, quarter=False) %}
{% for row in data %}
{% set rowloop = loop %}
<tr>
{% set extracheck = namespace(bold=False) %}
{% set supercheck = namespace(items=[]) %}
{% for cell in row %}
<!-- ROW: {{ rowloop.index }} -->
<!-- CELL: {{ loop.index }} -->
<!-- COLOR: {{ check.color }} -->
<!-- QUARTER: {{ check.quarter }} -->
{% if rowloop.index > 33 %}
{% set check.color = 'highlight' %}
{% else %}
{% if loop.index < 5 %}
{% set check.color = 'out' %}
{% elif loop.index < 8 %}
{% set check.color = 'in' %}
{% else %}
{% set check.color = 'black' %}
{% endif %}
{% endif %}
<!-- start of loop -->
{% if 'QUARTER' in cell|string or 'COMMON' in cell|string or 'TOTAL' in cell|string %}
{% set extracheck.bold = True %}
{% if 'QUARTER 1' in cell|string %}
{% set check.quarter = Q1 %}
{% elif 'QUARTER 2' in cell|string %}
{% set check.quarter = Q2 %}
{% elif 'QUARTER 3' in cell|string %}
{% set check.quarter = Q3 %}
{% elif 'QUARTER 4' in cell|string %}
{% set check.quarter = Q4 %}
{% endif %}
<td class="{{ check.color }}"><strong>{{ cell }}</strong></td>
{% elif 'infrastructure' in cell|string %}
{% for row in check.quarter %}
{% if 'infrastructure' in row[6] or 'treat' in row[6] %}
<div style="display: none;">{{ supercheck.items.append(row[0]) }}</div>
{% endif %}
{% endfor %}
<td class="{{ check.color }}">
{{ cell }}
{% if supercheck %}
<ul>
{% for item in supercheck.items %}
<li>{{ item }}</li>
{% endfor %}
</ul>
{% endif %}
</td>
{% elif 'EUR' in cell|string %}
{% set cell = cell.replace('EUR', '') %}
{% if extracheck.bold %}
{% if loop.index > 8 %}
{% if rowloop.index > 30 %}
{% set check.color = 'highlight' %}
{% endif %}
{% endif %}
<td class="{{ check.color }}"><strong>{{ '€ {:,.2f}'.format(cell|float) }}</strong></td>
{% else %}
<td class="{{ check.color }}">{{ '€ {:,.2f}'.format(cell|float) }}</td>
{% endif %}
{% elif '- - -' in cell|string %}
<td class="black"></td>
{%- elif cell|string == '' -%}
<td class="transparent">&nbsp;</td>
{% else %}
<td class="{{ check.color }}">{{ cell }}</td>
{% endif %}
{% endfor %}
<td class="transparent">&nbsp;</td>
</tr>
{% endfor %}
</tbody>
</table>
<hr>
<div>
Link to common fun(d) pad: <a href="https://pad.vvvvvvaria.org/common-fund-ins-and-outs" target="new">https://pad.vvvvvvaria.org/common-fund-ins-and-outs</a>
</div>
<hr>
<div>
This page is based on the financial spreadsheets of Varia. They are synced to the server with Syncthing (located at <code>/srv/train-your-core/finances/</code>) and processed with a Python script (located at <code>/var/www/intranet/common-fund</code>). This page is updated every night (using the <code>cron.sh</code> script in the same folder)!
</div>
</body>
</html>