Commit f344b8d3 authored by Claude Paroz's avatar Claude Paroz

Do not show figure stats when there is no figures

parent 07eedf1f
......@@ -1347,6 +1347,9 @@ class Statistics(models.Model):
{'messages': msg_text, 'updated': upd_text}
return text
def has_figures(self):
return bool(self.full_po and self.full_po.figures)
def get_figures(self):
""" Return an enriched list of figure dicts (used in module_images.html):
[{'path':, 'hash':, 'fuzzy':, 'translated':, 'translated_file':}, ...] """
......
......@@ -113,13 +113,10 @@ def vertimus(request, branch, domain, language, stats=None, level="0"):
else:
action_form = None
fig_stats = stats.fig_stats()
del fig_stats['prc']
context = {
'pageSection': 'module',
'stats': stats,
'pot_stats': pot_stats,
'fig_stats': fig_stats,
'po_url': stats.po_url(),
'po_url_reduced': stats.has_reducedstat() and stats.po_url(reduced=True) or '',
'branch': branch,
......@@ -134,6 +131,9 @@ def vertimus(request, branch, domain, language, stats=None, level="0"):
'level': level,
'grandparent_level': grandparent_level,
}
if stats.has_figures():
context['fig_stats'] = stats.fig_stats()
del context['fig_stats']['prc']
return render(request, 'vertimus/vertimus_detail.html', context)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment