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 ## 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) - On mobile, "My Checks" page, always show the gear (Details) button (#286)
- Make log events fit better on mobile screens - 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.body = body[:10000]
ping.save() ping.save()
def downtimes(self, months=2):
def downtimes(self, months=3):
""" Calculate the number of downtimes and downtime minutes per month. """ Calculate the number of downtimes and downtime minutes per month.
Returns a list of (datetime, downtime_in_secs, number_of_outages) tuples. 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 "" return ""
def month_boundaries(months=2):
def month_boundaries(months=3):
result = [] result = []
now = timezone.now() now = timezone.now()


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

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


Loading…
Cancel
Save