mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2025-01-11 09:45:27 +00:00
Fixes to how import times are estimated
The wrong attr was being used to grab the number of seconds, and imports that were stopped were being counted
This commit is contained in:
parent
cc95c4d7b5
commit
784dab3d41
1 changed files with 5 additions and 3 deletions
|
@ -45,7 +45,9 @@ class Import(View):
|
||||||
|
|
||||||
last_week = timezone.now() - datetime.timedelta(days=7)
|
last_week = timezone.now() - datetime.timedelta(days=7)
|
||||||
recent_avg = (
|
recent_avg = (
|
||||||
models.ImportJob.objects.filter(created_date__gte=last_week, complete=True)
|
models.ImportJob.objects.filter(
|
||||||
|
created_date__gte=last_week, status="complete"
|
||||||
|
)
|
||||||
.annotate(
|
.annotate(
|
||||||
runtime=ExpressionWrapper(
|
runtime=ExpressionWrapper(
|
||||||
F("updated_date") - F("created_date"),
|
F("updated_date") - F("created_date"),
|
||||||
|
@ -58,9 +60,9 @@ class Import(View):
|
||||||
if recent_avg:
|
if recent_avg:
|
||||||
seconds = recent_avg.total_seconds()
|
seconds = recent_avg.total_seconds()
|
||||||
if seconds > 60**2:
|
if seconds > 60**2:
|
||||||
data["recent_avg_hours"] = recent_avg.seconds / (60**2)
|
data["recent_avg_hours"] = seconds / (60**2)
|
||||||
else:
|
else:
|
||||||
data["recent_avg_minutes"] = recent_avg.seconds / 60
|
data["recent_avg_minutes"] = seconds / 60
|
||||||
|
|
||||||
return TemplateResponse(request, "import/import.html", data)
|
return TemplateResponse(request, "import/import.html", data)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue