diff --git a/hc/api/models.py b/hc/api/models.py index 7cf7059f..a7888362 100644 --- a/hc/api/models.py +++ b/hc/api/models.py @@ -92,7 +92,7 @@ class Check(models.Model): return "down" def in_grace_period(self): - if not self.last_ping: + if self.status in ("new", "paused"): return False up_ends = self.last_ping + self.timeout diff --git a/hc/api/tests/test_check_model.py b/hc/api/tests/test_check_model.py index 73b7181f..0269e0cc 100644 --- a/hc/api/tests/test_check_model.py +++ b/hc/api/tests/test_check_model.py @@ -27,3 +27,13 @@ class CheckModelTestCase(TestCase): self.assertTrue(check.in_grace_period()) self.assertEqual(check.get_status(), "up") + + def test_paused_check_is_not_in_grace_period(self): + check = Check() + + check.status = "up" + check.last_ping = timezone.now() - timedelta(days=1, minutes=30) + self.assertTrue(check.in_grace_period()) + + check.status = "paused" + self.assertFalse(check.in_grace_period()) diff --git a/hc/front/views.py b/hc/front/views.py index 1d2500d4..555668d6 100644 --- a/hc/front/views.py +++ b/hc/front/views.py @@ -44,7 +44,7 @@ def my_checks(request): if status == "down": down_tags.add(tag) - elif check.in_grace_period() and status != "paused": + elif check.in_grace_period(): grace_tags.add(tag) ctx = { diff --git a/templates/emails/summary-html.html b/templates/emails/summary-html.html index 19c78783..9bccf6f8 100644 --- a/templates/emails/summary-html.html +++ b/templates/emails/summary-html.html @@ -57,6 +57,8 @@