Browse Source

Fix pruneflips

pull/761/head
Pēteris Caune 1 year ago
parent
commit
5e826ec15a
No known key found for this signature in database GPG Key ID: E28D7679E9A9EDE2
  1. 4
      hc/api/management/commands/pruneflips.py

4
hc/api/management/commands/pruneflips.py

@ -1,5 +1,7 @@
from __future__ import annotations
from datetime import timedelta as td
from django.core.management.base import BaseCommand
from hc.api.models import Flip
@ -10,7 +12,7 @@ class Command(BaseCommand):
help = "Prune old Flip objects."
def handle(self, *args, **options):
threshold = min(month_boundaries(months=3))
threshold = min(month_boundaries(3, "UTC")) - td(days=1)
q = Flip.objects.filter(created__lt=threshold)
n_pruned, _ = q.delete()

Loading…
Cancel
Save