def METHOD_NAME(queryset):
    if flag_set('fflag_fix_back_LSDV_961_project_list_09022023_short', user='auto'):
        subquery = Annotation.objects.filter(
            Q(project=OuterRef('pk'))
            & Q(ground_truth=True)
        ).values('id')
        return queryset.annotate(ground_truth_number=SQCount(subquery))
    else:
        return queryset.annotate(ground_truth_number=Count(
            'tasks__annotations__id', distinct=True, filter=Q(tasks__annotations__ground_truth=True)
        ))