Commit 6cd174cd authored by Enrico Zini's avatar Enrico Zini
Browse files

Deal with missing stats

parent 4210c247
......@@ -154,6 +154,7 @@ See: <a href="http://lists.debian.org/debian-project/2010/09/msg00026.html">hand
{% endif %}
</td>
</tr>
{% if mbox_stats %}
<tr><th>Mailbox stats</th>
<td>{{mbox_stats.date_first_py|date:"Y-m-d"}} to {{mbox_stats.date_last_py|date:"Y-m-d"}},
{{mbox_stats.num_mails}} mails,
......@@ -165,6 +166,7 @@ See: <a href="http://lists.debian.org/debian-project/2010/09/msg00026.html">hand
</td>
</tr>
{% endif %}
{% endif %}
</table>
{% if "edit_bio" in vperms.perms or "edit_ldap" in vperms.perms %}
<a href="{% url 'restricted_person' key=person.lookup_key %}">Edit personal information</a>
......
......@@ -227,13 +227,14 @@ class Process(VisitorTemplateView):
stats = stats.get("process", {})
stats = stats.get(process.lookup_key, {})
stats["date_first_py"] = datetime.datetime.fromtimestamp(stats["date_first"])
stats["date_last_py"] = datetime.datetime.fromtimestamp(stats["date_last"])
if "median" not in stats or stats["median"] is None:
stats["median_py"] = None
else:
stats["median_py"] = datetime.timedelta(seconds=stats["median"])
stats["median_hours"] = stats["median_py"].seconds // 3600
if stats:
stats["date_first_py"] = datetime.datetime.fromtimestamp(stats["date_first"])
stats["date_last_py"] = datetime.datetime.fromtimestamp(stats["date_last"])
if "median" not in stats or stats["median"] is None:
stats["median_py"] = None
else:
stats["median_py"] = datetime.timedelta(seconds=stats["median"])
stats["median_hours"] = stats["median_py"].seconds // 3600
ctx["mbox_stats"] = stats
return ctx
......
Supports Markdown
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