49d41416e440926f0a9a8243b4d77f6f5468efe9,app/server/api.py,StatisticsAPI,progress,#StatisticsAPI#Any#,53

Before Change


        remaining = 0
        annotation_class = project.get_annotation_class()
        for d in project.documents.all():
            count = annotation_class.objects.filter(document=d).count()
            if count == 0:
                remaining += 1
        return {"total": total, "remaining": remaining}

After Change


        docs = project.documents
        annotation_class = project.get_annotation_class()
        total = docs.count()
        done = annotation_class.objects.filter(document_id__in=docs.all()).\
            aggregate(Count("document", distinct=True))["document__count"]
        remaining = total - done
        return {"total": total, "remaining": remaining}

    def label_per_data(self, project):
        label_count = Counter()
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 3

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: progress


Project Name: snorkel-team/snorkel
Commit Name: 8b0cd381ecb7f5bef1fa22caf3394fc4767359a0
Time: 2017-01-14
Author: ajratner@gmail.com
File Name: snorkel/annotations.py
Class Name: Annotator
Method Name: apply


Project Name: samuelclay/NewsBlur
Commit Name: 6e93972ada9577ce41af8681de3f8a080f45f418
Time: 2011-11-01
Author: samuel@ofbrooklyn.com
File Name: utils/munin/newsblur_errors.py
Class Name:
Method Name: calculate_metrics


Project Name: AlexsLemonade/refinebio
Commit Name: 3f5563740b444d0f8eb86f87eb30edc3d0ff9189
Time: 2019-06-19
Author: arielsvn@gmail.com
File Name: workers/data_refinery_workers/processors/qn_reference.py
Class Name:
Method Name: _update_experiment_caches