Skip to content

Commit

Permalink
Slight trims
Browse files Browse the repository at this point in the history
  • Loading branch information
palewire committed Jul 16, 2017
1 parent c8c57f5 commit b3bfbdf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ def get_scraped_props(self, scraped_elec):
Return QuerySet.
"""
# Recalls are being excluded so they can be loaded in a separate command.
return scraped_elec.propositions.exclude(name__icontains='RECALL')

def get_or_create_election(self, scraped_elec):
Expand Down Expand Up @@ -110,13 +111,12 @@ def create_contest(self, scraped_prop, ocd_elec):
else:
classification = 'ballot measure'
# Create the object
ocd_contest = BallotMeasureContest.objects.create(
return BallotMeasureContest.objects.create(
election=ocd_elec,
division=self.state_division,
name=scraped_prop.name,
classification=classification,
)
return ocd_contest

def load(self):
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,14 @@ def create_contest(self, scraped_prop, ocd_elec):
raise Exception(
"Unknown Incumbent in %s." % scraped_prop.name
)

# get or create person and post objects
person = self.get_or_create_person(
incumbent.name,
filer_id=incumbent.scraped_id,
)[0]
post = self.get_or_create_post(incumbent.office_name)[0]

# get or create membership object
membership = Membership.objects.get_or_create(
person=person,
Expand All @@ -77,6 +79,7 @@ def create_contest(self, scraped_prop, ocd_elec):
organization=post.organization,
person_name=person.sort_name,
)[0]

# set the start_date and end_date for Governor Gray Davis
if scraped_prop.name == '2003 RECALL QUESTION':
membership.start_date = '1999'
Expand Down

0 comments on commit b3bfbdf

Please sign in to comment.