Skip to content

Commit

Permalink
set null committee name to empty string so that we can get consistent
Browse files Browse the repository at this point in the history
outputs when the postgres version changes
  • Loading branch information
ChenglimEar committed Jul 16, 2024
1 parent b4e4113 commit 710218c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ do-import-spreadsheets:
./bin/remove-whitespace $(DATABASE_NAME) candidates Twitter
./bin/remove-whitespace $(DATABASE_NAME) candidates Bio
./bin/make-null-empty $(DATABASE_NAME) candidates data_warning
./bin/make-null-empty $(DATABASE_NAME) candidates Committee_Name

echo 'DROP TABLE IF EXISTS referendums CASCADE;' | psql $(DATABASE_NAME)
./bin/create-table $(DATABASE_NAME) $(CSV_PATH) referendums
Expand All @@ -108,6 +109,7 @@ do-import-spreadsheets:
csvsql --db postgresql:///$(DATABASE_NAME) --insert --no-create --no-inference $(CSV_PATH)/committees.csv
echo 'ALTER TABLE "committees" ADD COLUMN id SERIAL PRIMARY KEY;' | psql $(DATABASE_NAME)
./bin/remove-whitespace $(DATABASE_NAME) committees Filer_NamL
./bin/make-null-empty $(DATABASE_NAME) committees Filer_NamL
./bin/make-null-empty $(DATABASE_NAME) committees data_warning

echo 'DROP TABLE IF EXISTS office_elections CASCADE;' | psql $(DATABASE_NAME)
Expand Down
3 changes: 2 additions & 1 deletion calculators/election_top_contributors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ def fetch
FROM "combined_contributions"
WHERE "election_name" <> ''
AND "Committee_Type" IN ('CAO', 'CTL', 'BMC', 'SMO')
GROUP BY "election_name", type, name;
GROUP BY "election_name", type, name
ORDER BY "election_name", type, name;
SQL

results_by_election = election_results.each_with_object({}) do |result, hash|
Expand Down

0 comments on commit 710218c

Please sign in to comment.