Browse Source

Sort by id, not `created`, when pruning pings.

pull/25/merge
Pēteris Caune 9 years ago
parent
commit
b9ae8d464c
2 changed files with 2 additions and 2 deletions
  1. +1
    -1
      hc/api/models.py
  2. +1
    -1
      hc/api/tests/test_check_model.py

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

@ -104,7 +104,7 @@ class Check(models.Model):
"""
pings = Ping.objects.filter(owner=self).order_by("-created")
pings = Ping.objects.filter(owner=self).order_by("-id")
cutoff = pings[keep_limit:keep_limit+1]
# If cutoff is empty slice then the check has less than `keep_limit`


+ 1
- 1
hc/api/tests/test_check_model.py View File

@ -9,7 +9,7 @@ class CheckModelTestCase(TestCase):
check.save()
for i in range(0, 6):
p = Ping(pk=100 + i, owner=check, ua="UA%d" % i)
p = Ping(owner=check, ua="UA%d" % i)
p.save()
check.prune_pings(keep_limit=3)


Loading…
Cancel
Save