Browse Source

In monthly reports, no downtime stats for the current month (month has just started)

pull/307/head
Pēteris Caune 5 years ago
parent
commit
9cbd3bfc5a
No known key found for this signature in database GPG Key ID: E28D7679E9A9EDE2
4 changed files with 9 additions and 3 deletions
  1. +3
    -1
      CHANGELOG.md
  2. +1
    -1
      hc/api/models.py
  3. +1
    -1
      hc/lib/date.py
  4. +4
    -0
      templates/emails/summary-downtimes-html.html

+ 3
- 1
CHANGELOG.md View File

@ -3,8 +3,10 @@ All notable changes to this project will be documented in this file.
## Unreleased
### Bug Fixes
### Improvements
- In monthly reports, no downtime stats for the current month (month has just started)
### Bug Fixes
- On mobile, "My Checks" page, always show the gear (Details) button (#286)
- Make log events fit better on mobile screens


+ 1
- 1
hc/api/models.py View File

@ -273,7 +273,7 @@ class Check(models.Model):
ping.body = body[:10000]
ping.save()
def downtimes(self, months=2):
def downtimes(self, months=3):
""" Calculate the number of downtimes and downtime minutes per month.
Returns a list of (datetime, downtime_in_secs, number_of_outages) tuples.


+ 1
- 1
hc/lib/date.py View File

@ -68,7 +68,7 @@ def format_approx_duration(td):
return ""
def month_boundaries(months=2):
def month_boundaries(months=3):
result = []
now = timezone.now()


+ 4
- 0
templates/emails/summary-downtimes-html.html View File

@ -7,9 +7,11 @@
{{ group.grouper|mangle_link }}
</td>
{% for dt in month_boundaries %}
{% if not forloop.last %}
<td style="padding: 32px 8px 8px 8px; margin: 0; font-size: 12px; color: #9BA2AB; font-family: Helvetica, Arial, sans-serif;">
{{ dt|date:"N Y"}}
</td>
{% endif %}
{% endfor %}
</tr>
{% for check in group.list|sortchecks:sort %}
@ -63,6 +65,7 @@
{% endif %}
</td>
{% for boundary, seconds, count in check.downtimes %}
{% if not forloop.last %}
{% if count %}
<td style="border-top: 1px solid #EDEFF2; padding: 16px 8px; font-family: Helvetica, Arial, sans-serif;">
{{ count }} downtime{{ count|pluralize }},
@ -74,6 +77,7 @@
All good!
</td>
{% endif %}
{% endif %}
{% endfor %}
</tr>
{% endfor %}


Loading…
Cancel
Save