GrafeasGroup / blossom

The website. The app. The everything.
6 stars 3 forks source link

Fix total transcription count returned by `/summary/` #180

Closed TimJentzsch closed 3 years ago

TimJentzsch commented 3 years ago

The /summary/ endpoint simply counts the number of transcription objects to determine the total number of transcriptions. However, this also includes transcriptions done by the OCR bot, so the number is way off.

The proper way to do this is to use

Submission.objects.filter(completed_by__isnull=False).count()

This will only include human transcriptions.

Demonstration on prod:

>>> from api.models import *
>>> Submission.objects.filter(completed_by__isnull=False).count()
163828

(As reference, the endpoint currently returns 200969)