Fixes "indeterminate" state of progress indicator on screen reader

This commit is contained in:
Mouse Reeve 2021-11-15 09:34:36 -08:00
parent 77ee1147d5
commit 83e468a4f8
2 changed files with 13 additions and 8 deletions

View file

@ -51,7 +51,7 @@
</span>
</div>
<div class="is-flex">
<progress class="progress is-success is-medium mr-2" value="{{ percent }}" max="100">{{ percent }}%</progress>
<progress role="progressbar" class="progress is-success is-medium mr-2" value="{{ complete_count }}" max="{{ item_count }}" aria-min="0" aria-valuenow="{{ complete_count }}" aria-valuemax="{{ item_count }}"">{{ percent }} %</progress>
<span>{{ percent }}%</span>
</div>
</div>

View file

@ -32,20 +32,25 @@ class ImportStatus(View):
paginated = Paginator(items, PAGE_LENGTH)
page = paginated.get_page(request.GET.get("page"))
manual_review_count = items.filter(
fail_reason__isnull=False, book_guess__isnull=False, book__isnull=True
).count()
fail_count = items.filter(
fail_reason__isnull=False, book_guess__isnull=True
).count()
pending_item_count = job.pending_items.count()
data = {
"job": job,
"items": page,
"manual_review_count": items.filter(
fail_reason__isnull=False, book_guess__isnull=False, book__isnull=True
).count(),
"fail_count": items.filter(
fail_reason__isnull=False, book_guess__isnull=True
).count(),
"manual_review_count": manual_review_count,
"fail_count": fail_count,
"page_range": paginated.get_elided_page_range(
page.number, on_each_side=2, on_ends=1
),
"item_count": item_count,
"complete_count": item_count - pending_item_count,
"percent": math.floor( # pylint: disable=c-extension-no-member
(item_count - job.pending_items.count()) / item_count * 100
(item_count - pending_item_count) / item_count * 100
),
# hours since last import item update
"inactive_time": (job.updated_date - timezone.now()).seconds / 60 / 60,