1
0
Fork 0

Another tweak to how import wait times are calculated

This commit is contained in:
Mouse Reeve 2022-11-10 13:59:27 -08:00
parent eae1866992
commit 49d0590599
2 changed files with 25 additions and 1 deletions

View file

@ -94,7 +94,8 @@ def get_average_import_time() -> float:
"""Helper to figure out how long imports are taking (returns seconds)"""
last_week = timezone.now() - datetime.timedelta(days=7)
recent_avg = (
models.ImportJob.objects.filter(created_date__gte=last_week, status="complete")
models.ImportJob.objects.filter(created_date__gte=last_week, complete=True)
.exclude(status="stopped")
.annotate(
runtime=ExpressionWrapper(
F("updated_date") - F("created_date"),