diff options
author | Jordan <me@jordan.im> | 2019-06-25 23:26:20 -0700 |
---|---|---|
committer | Jordan <me@jordan.im> | 2019-06-25 23:26:20 -0700 |
commit | 8f3008432b3e8e960216143bebfebca6cfffd246 (patch) | |
tree | 43980d99c9bb42b58fe144f08dd081d3065a773a | |
parent | 73122ffc66651a720ce40b6d28a37b55c72e66b5 (diff) | |
download | allium-8f3008432b3e8e960216143bebfebca6cfffd246.tar.gz allium-8f3008432b3e8e960216143bebfebca6cfffd246.zip |
display family count conditionally, clean family dir if it exists
-rwxr-xr-x | tor-metrics/generate.py | 2 | ||||
-rw-r--r-- | tor-metrics/templates/base.html | 3 |
2 files changed, 4 insertions, 1 deletions
diff --git a/tor-metrics/generate.py b/tor-metrics/generate.py index fdb0a25..b6b2b3c 100755 --- a/tor-metrics/generate.py +++ b/tor-metrics/generate.py @@ -33,6 +33,8 @@ def unsorted(relays, filename, is_index): def effective_family(relays): template = env.get_template('effective_family.html') output_path = os.path.join(config.CONFIG['output_root'], 'family') + if os.path.exists(output_path): + rmtree(output_path) relay_list = relays.json['relays'] q_relays = [] # qualified relays w/ > 1 effective family member for relay in relay_list: diff --git a/tor-metrics/templates/base.html b/tor-metrics/templates/base.html index 697418f..a3f4560 100644 --- a/tor-metrics/templates/base.html +++ b/tor-metrics/templates/base.html @@ -37,9 +37,10 @@ {% set obs_bandwidth = '%s %s'|format((relay['observed_bandwidth'] / 1000)|round(2, 'common'), 'KB/s') %}{% endif %} {% if category != 'family' %} + {% if relay['effective_family']|length > 1 %} <td>{{ relay['nickname'] }} (<a href="{{ path_prefix }}family/{{ relay['effective_family'][0] }}/">{{ relay['effective_family']|length }}</a>)</td> {% else %} - <td>{{ relay['nickname'] }}</td>{% endif %} + <td>{{ relay['nickname'] }}</td>{% endif %}{% endif %} <td>{{ obs_bandwidth }}</td> <td class="visible-md visible-lg">{{ relay['or_addresses'][0].split(':', 1)[0] }}</td> |