Skip to content

Commit

Permalink
change election name in digests.json to include full date to correctly
Browse files Browse the repository at this point in the history
capture multiple elections in the same year
  • Loading branch information
ChenglimEar committed Jul 19, 2024
1 parent f2358af commit 0d6d8a2
Show file tree
Hide file tree
Showing 9 changed files with 331 additions and 201 deletions.
12 changes: 6 additions & 6 deletions bin/create-digests
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,9 @@ def add_tickets_total(digests, ticket_type='candidates', total_key='total_contri
for region in regions:
elections = os.listdir(f'{dirpath}/{region}')
for election in elections:
election_year = election.split('-')[0]
election_name = f'{region}-{election_year}'
election_year = election.split('-')[0] # TODO: remove this when no longer required
# We have to use the full date for the election name since there can be more than one election in a year
election_name = f'{region}-{election}'
if not election_name in digests[f'_{total_group_key}']:
digests[f'_{total_group_key}'][election_name] = {}
election_total = 0.0
Expand Down Expand Up @@ -253,8 +254,9 @@ def add_elections_total(digests, total_key='total_contributions', total_group_ke
for filename in filenames:
if filename.endswith('.json'):
election = filename.replace('.json','')
election_year = election.split('-')[0]
election_name = f'{region}-{election_year}'
election_year = election.split('-')[0] # TODO: remove later if we don't need it
# We have to use the full date instead of the year for the name to support multiple elections in a year
election_name = f'{region}-{election}'
if not election_name in digests[f'_{total_group_key}']:
digests[f'_{total_group_key}'][election_name] = {}
filepath = f'{dirpath}/{region}/{filename}'
Expand Down Expand Up @@ -282,8 +284,6 @@ def add_elections_total(digests, total_key='total_contributions', total_group_ke
total += election_total

digests[f'_{total_group_key}'][election_name][full_total_key] = round(election_total,2)
if election_name == 'oakland-2024':
digests[f'_{total_group_key}'][election_name][f'{full_total_key}_numbers'] = election_total_numbers

digests[f'_{total_group_key}'][full_total_key] = round(total,2)

Expand Down
4 changes: 2 additions & 2 deletions build/_data/elections/oakland/2018-06-05.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"total_spending": 15000.0
},
{
"name": "Oakland Athletics Baseball Company",
"name": "Service Employees International Union Local 1021 Issues PAC",
"type": "Measure",
"election_name": "oakland-june-2018",
"total_spending": 10000.0
Expand All @@ -100,7 +100,7 @@
"total_spending": 15000.0
},
{
"name": "Oakland Athletics Baseball Company",
"name": "Service Employees International Union Local 1021 Issues PAC",
"type": "Measure",
"election_name": "oakland-june-2018",
"total_spending": 10000.0
Expand Down
12 changes: 6 additions & 6 deletions build/_data/elections/oakland/2023-11-07.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,39 +96,39 @@
],
"top_spenders": [
{
"name": "Service Employees International Union Local 1021 Candidate PAC",
"name": "Laborers Local 304",
"type": "Office",
"election_name": "oakland-2023",
"total_spending": 1200.0
},
{
"name": "Oakland Education Association PAC",
"name": "UA Local 342",
"type": "Office",
"election_name": "oakland-2023",
"total_spending": 1200.0
},
{
"name": "Families in Action for Justice",
"name": "Service Employees International Union Local 1021 Candidate PAC",
"type": "Office",
"election_name": "oakland-2023",
"total_spending": 1200.0
}
],
"top_spenders_for_offices": [
{
"name": "Service Employees International Union Local 1021 Candidate PAC",
"name": "Laborers Local 304",
"type": "Office",
"election_name": "oakland-2023",
"total_spending": 1200.0
},
{
"name": "Oakland Education Association PAC",
"name": "UA Local 342",
"type": "Office",
"election_name": "oakland-2023",
"total_spending": 1200.0
},
{
"name": "Families in Action for Justice",
"name": "Service Employees International Union Local 1021 Candidate PAC",
"type": "Office",
"election_name": "oakland-2023",
"total_spending": 1200.0
Expand Down
12 changes: 6 additions & 6 deletions build/_data/elections/oakland/2024-03-05.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,39 +71,39 @@
],
"top_spenders": [
{
"name": "Monique C Houston",
"name": "Araina Lynn Hennen",
"type": "Office",
"election_name": "oakland-march-2024",
"total_spending": 600.0
},
{
"name": "Steven Von Stade",
"name": "Monique C Houston",
"type": "Office",
"election_name": "oakland-march-2024",
"total_spending": 600.0
},
{
"name": "Mary Preston",
"name": "Steven Von Stade",
"type": "Office",
"election_name": "oakland-march-2024",
"total_spending": 600.0
}
],
"top_spenders_for_offices": [
{
"name": "Monique C Houston",
"name": "Araina Lynn Hennen",
"type": "Office",
"election_name": "oakland-march-2024",
"total_spending": 600.0
},
{
"name": "Steven Von Stade",
"name": "Monique C Houston",
"type": "Office",
"election_name": "oakland-march-2024",
"total_spending": 600.0
},
{
"name": "Mary Preston",
"name": "Steven Von Stade",
"type": "Office",
"election_name": "oakland-march-2024",
"total_spending": 600.0
Expand Down
12 changes: 6 additions & 6 deletions build/_data/elections/oakland/2024-11-05.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,39 +102,39 @@
],
"top_spenders": [
{
"name": "International Association of Firefighters Local 55",
"name": "International Federation of Professional and Technical Engineers-Local 21 TJ Anthony PAC Fund",
"type": "Office",
"election_name": "oakland-2024",
"total_spending": 2400.0
},
{
"name": "International Federation of Professional and Technical Engineers-Local 21 TJ Anthony PAC Fund",
"name": "International Association of Firefighters Local 55",
"type": "Office",
"election_name": "oakland-2024",
"total_spending": 2400.0
},
{
"name": "Todd Scanlin",
"name": "Courtney Dykstra",
"type": "Office",
"election_name": "oakland-2024",
"total_spending": 1800.0
}
],
"top_spenders_for_offices": [
{
"name": "International Association of Firefighters Local 55",
"name": "International Federation of Professional and Technical Engineers-Local 21 TJ Anthony PAC Fund",
"type": "Office",
"election_name": "oakland-2024",
"total_spending": 2400.0
},
{
"name": "International Federation of Professional and Technical Engineers-Local 21 TJ Anthony PAC Fund",
"name": "International Association of Firefighters Local 55",
"type": "Office",
"election_name": "oakland-2024",
"total_spending": 2400.0
},
{
"name": "Todd Scanlin",
"name": "Courtney Dykstra",
"type": "Office",
"election_name": "oakland-2024",
"total_spending": 1800.0
Expand Down
2 changes: 1 addition & 1 deletion build/_data/stats.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"date_processed": "2024-07-18 00:08:27 -0700"
"date_processed": "2024-07-18 07:08:27 +0000"
}
40 changes: 20 additions & 20 deletions build/_data/totals.json
Original file line number Diff line number Diff line change
Expand Up @@ -1052,7 +1052,7 @@
"total_spending": 15000.0
},
{
"name": "Oakland Athletics Baseball Company",
"name": "Service Employees International Union Local 1021 Issues PAC",
"type": "Measure",
"election_name": "oakland-june-2018",
"total_spending": 10000.0
Expand All @@ -1075,7 +1075,7 @@
"total_spending": 15000.0
},
{
"name": "Oakland Athletics Baseball Company",
"name": "Service Employees International Union Local 1021 Issues PAC",
"type": "Measure",
"election_name": "oakland-june-2018",
"total_spending": 10000.0
Expand Down Expand Up @@ -1408,39 +1408,39 @@
],
"top_spenders": [
{
"name": "Service Employees International Union Local 1021 Candidate PAC",
"name": "Laborers Local 304",
"type": "Office",
"election_name": "oakland-2023",
"total_spending": 1200.0
},
{
"name": "Oakland Education Association PAC",
"name": "UA Local 342",
"type": "Office",
"election_name": "oakland-2023",
"total_spending": 1200.0
},
{
"name": "Families in Action for Justice",
"name": "Service Employees International Union Local 1021 Candidate PAC",
"type": "Office",
"election_name": "oakland-2023",
"total_spending": 1200.0
}
],
"top_spenders_for_offices": [
{
"name": "Service Employees International Union Local 1021 Candidate PAC",
"name": "Laborers Local 304",
"type": "Office",
"election_name": "oakland-2023",
"total_spending": 1200.0
},
{
"name": "Oakland Education Association PAC",
"name": "UA Local 342",
"type": "Office",
"election_name": "oakland-2023",
"total_spending": 1200.0
},
{
"name": "Families in Action for Justice",
"name": "Service Employees International Union Local 1021 Candidate PAC",
"type": "Office",
"election_name": "oakland-2023",
"total_spending": 1200.0
Expand Down Expand Up @@ -1523,39 +1523,39 @@
],
"top_spenders": [
{
"name": "Monique C Houston",
"name": "Araina Lynn Hennen",
"type": "Office",
"election_name": "oakland-march-2024",
"total_spending": 600.0
},
{
"name": "Steven Von Stade",
"name": "Monique C Houston",
"type": "Office",
"election_name": "oakland-march-2024",
"total_spending": 600.0
},
{
"name": "Mary Preston",
"name": "Steven Von Stade",
"type": "Office",
"election_name": "oakland-march-2024",
"total_spending": 600.0
}
],
"top_spenders_for_offices": [
{
"name": "Monique C Houston",
"name": "Araina Lynn Hennen",
"type": "Office",
"election_name": "oakland-march-2024",
"total_spending": 600.0
},
{
"name": "Steven Von Stade",
"name": "Monique C Houston",
"type": "Office",
"election_name": "oakland-march-2024",
"total_spending": 600.0
},
{
"name": "Mary Preston",
"name": "Steven Von Stade",
"type": "Office",
"election_name": "oakland-march-2024",
"total_spending": 600.0
Expand Down Expand Up @@ -1669,39 +1669,39 @@
],
"top_spenders": [
{
"name": "International Association of Firefighters Local 55",
"name": "International Federation of Professional and Technical Engineers-Local 21 TJ Anthony PAC Fund",
"type": "Office",
"election_name": "oakland-2024",
"total_spending": 2400.0
},
{
"name": "International Federation of Professional and Technical Engineers-Local 21 TJ Anthony PAC Fund",
"name": "International Association of Firefighters Local 55",
"type": "Office",
"election_name": "oakland-2024",
"total_spending": 2400.0
},
{
"name": "Todd Scanlin",
"name": "Courtney Dykstra",
"type": "Office",
"election_name": "oakland-2024",
"total_spending": 1800.0
}
],
"top_spenders_for_offices": [
{
"name": "International Association of Firefighters Local 55",
"name": "International Federation of Professional and Technical Engineers-Local 21 TJ Anthony PAC Fund",
"type": "Office",
"election_name": "oakland-2024",
"total_spending": 2400.0
},
{
"name": "International Federation of Professional and Technical Engineers-Local 21 TJ Anthony PAC Fund",
"name": "International Association of Firefighters Local 55",
"type": "Office",
"election_name": "oakland-2024",
"total_spending": 2400.0
},
{
"name": "Todd Scanlin",
"name": "Courtney Dykstra",
"type": "Office",
"election_name": "oakland-2024",
"total_spending": 1800.0
Expand Down
Loading

0 comments on commit 0d6d8a2

Please sign in to comment.