• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

DemocracyClub / yournextrepresentative / 74df76c8-4768-48d5-bb7f-5ee50aa05217

06 Nov 2023 01:38PM UTC coverage: 67.523% (-0.3%) from 67.801%
74df76c8-4768-48d5-bb7f-5ee50aa05217

Pull #2177

circleci

VirginiaDooley
Create TextractResults model
Pull Request #2177: Spike: AWS Textract

1640 of 2760 branches covered (0.0%)

Branch coverage included in aggregate %.

12 of 62 new or added lines in 3 files covered. (19.35%)

110 existing lines in 10 files now uncovered.

6662 of 9535 relevant lines covered (69.87%)

0.7 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

80.0
/ynr/apps/sopn_parsing/helpers/command_helpers.py
1
from candidates.models import Ballot
1✔
2
from django.core.management.base import BaseCommand, CommandError
1✔
3

4

5
class BaseSOPNParsingCommand(BaseCommand):
1✔
6
    def add_arguments(self, parser):
1✔
7
        parser.add_argument(
1✔
8
            "--ballot", action="store", help="Parse tables for a single ballot"
9
        )
10
        parser.add_argument(
1✔
11
            "--current",
12
            action="store_true",
13
            help="Only process current ballots",
14
        )
15
        parser.add_argument(
1✔
16
            "--reparse",
17
            action="store_true",
18
            help="Reparse documents that have already been parsed",
19
        )
20
        parser.add_argument(
1✔
21
            "--testing",
22
            action="store_true",
23
            help="Force all ballots with official documents to be parsed",
24
        )
25
        parser.add_argument(
1✔
26
            "--election-slugs", "-s", action="store", required=False
27
        )
28

29
    def get_queryset(self, options):
1✔
30
        filter_kwargs = {}
1✔
31

32
        if options.get("ballot") and options.get("election-slugs"):
1!
33
            raise CommandError("Cant use ballot id and election slugs together")
×
34

35
        if options.get("election_slugs"):
1!
36
            filter_kwargs["election__slug__in"] = options.get(
×
37
                "election_slugs"
38
            ).split(",")
39

40
        if options.get("ballot"):
1!
UNCOV
41
            filter_kwargs["ballot_paper_id"] = options["ballot"]
×
42

43
        if options["current"]:
1✔
44
            filter_kwargs["election__current"] = True
1✔
45
        qs = Ballot.objects.all()
1✔
46
        qs = qs.filter(**filter_kwargs)
1✔
47
        return qs.exclude(officialdocument=None)
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc