49d41416e440926f0a9a8243b4d77f6f5468efe9,app/server/api.py,StatisticsAPI,label_per_data,#StatisticsAPI#Any#,63

Before Change


        annotation_class = project.get_annotation_class()
        for doc in project.documents.all():
            annotations = annotation_class.objects.filter(document=doc.id)
            for a in annotations:
                label_count[a.label.text] += 1
                user_count[a.user.username] += 1
        return label_count, user_count


class LabelList(generics.ListCreateAPIView):

After Change


        annotation_class = project.get_annotation_class()
        docs = project.documents.all()
        annotations = annotation_class.objects.filter(document_id__in=docs.all())
        for d in annotations.values("label__text", "user__username").annotate(Count("label"), Count("user")):
            label_count[d["label__text"]] += d["label__count"]
            user_count[d["user__username"]] += d["user__count"]
        return label_count, user_count
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: chakki-works/doccano
Commit Name: 49d41416e440926f0a9a8243b4d77f6f5468efe9
Time: 2019-03-12
Author: light.tree.1.13@gmail.com
File Name: app/server/api.py
Class Name: StatisticsAPI
Method Name: label_per_data


Project Name: Rostlab/nalaf
Commit Name: 8a2e857746dbab697b0045aa6c38133f3de71250
Time: 2016-11-14
Author: i@juanmi.rocks
File Name: nalaf/learning/taggers.py
Class Name: StubSameSentenceRelationExtractor
Method Name: annotate


Project Name: chakki-works/doccano
Commit Name: 49d41416e440926f0a9a8243b4d77f6f5468efe9
Time: 2019-03-12
Author: light.tree.1.13@gmail.com
File Name: app/server/api.py
Class Name: StatisticsAPI
Method Name: label_per_data


Project Name: AlexsLemonade/refinebio
Commit Name: 99d2d1aced54a9673b9e25b6c1f992acd20535e1
Time: 2019-08-16
Author: arielsvn@gmail.com
File Name: common/data_refinery_common/rna_seq.py
Class Name:
Method Name: get_quant_results_for_experiment