Sort by id, not created, when pruning pings.

This commit is contained in:
Pēteris Caune 2016-01-02 22:27:25 +02:00
parent 7019325b48
commit b9ae8d464c
2 changed files with 2 additions and 2 deletions

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`

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)