Skip to content

"Number of annotations" for a user in a project includes rejected/timed out #408

@ianroberts

Description

@ianroberts

Describe the bug

@property
def num_annotations(self):
"""Number of annotations completed by this annotator in this project"""
count = 0
for d in self.project.documents.filter(doc_type=DocumentType.ANNOTATION):
count += d.annotations.filter(user=self.annotator).count()
return count

The comment on this property (of the AnnotatorProject join-table class) suggests that it is supposed to count the number of completed annotations for the given user on the given project, but it actually counts all Annotation objects in the project that reference the user, including those that are rejected, timed-out or pending. Since a timed-out document can be issued to the same user again later in their annotation cycle, this can lead to the situation where the UI suggests the user has annotated more documents than are available in the project:

Screenshot 2024-04-02 at 17 57 30

Expected behavior

The total should only count completed documents (or possibly completed and rejected), not timed out or pending (in progress).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions