Skip to content

Commit

Permalink
Remove unused CandidateHistoryLatest model
Browse files Browse the repository at this point in the history
- Drop MV: ofec_candidate_history_latest_mv
- Remove MV from refresh management task
- Remove factories for CandidateHistoryLatest
  • Loading branch information
lbeaufort committed Jun 12, 2018
1 parent 384ed83 commit faa1e69
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 26 deletions.
2 changes: 2 additions & 0 deletions data/migrations/V0085__fix_ofec_candidate_totals_mv.sql
Original file line number Diff line number Diff line change
Expand Up @@ -290,5 +290,7 @@ CREATE INDEX ofec_candidate_totals_with_0s_mv_is_election_idx
CREATE INDEX ofec_candidate_totals_with_0s_mv_receipts_idx
ON ofec_candidate_totals_with_0s_mv USING btree (receipts);

--MV no longer needed

DROP MATERIALIZED VIEW IF EXISTS ofec_candidate_history_latest_mv

1 change: 0 additions & 1 deletion manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,6 @@ def refresh_materialized(concurrent=True):
'candidate_flags': ['ofec_candidate_flag_mv'],
'candidate_fulltext': ['ofec_candidate_fulltext_mv'],
'candidate_history': ['ofec_candidate_history_mv'],
'candidate_history_latest': ['ofec_candidate_history_latest_mv'],
'committee_detail': ['ofec_committee_detail_mv'],
'committee_fulltext': ['ofec_committee_fulltext_mv'],
'committee_history': ['ofec_committee_history_mv'],
Expand Down
5 changes: 0 additions & 5 deletions tests/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,6 @@ class Meta:
candidate_inactive = False


class CandidateHistoryLatestFactory(CandidateHistoryFactory):
class Meta:
model = models.CandidateHistoryLatest


class CandidateElectionFactory(BaseCandidateFactory):
class Meta:
model = models.CandidateElection
Expand Down
14 changes: 0 additions & 14 deletions webservices/common/models/candidates.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,20 +115,6 @@ class CandidateHistory(BaseCandidate):
active_through = db.Column(db.Integer, doc=docs.ACTIVE_THROUGH)


class CandidateHistoryLatest(BaseCandidate):
__tablename__ = 'ofec_candidate_history_latest_mv'
#Is there any good reason to have this as a separate model?
candidate_id = db.Column(db.String, primary_key=True, index=True)
two_year_period = db.Column(db.Integer, primary_key=True, index=True)
candidate_election_year = db.Column(db.Integer, doc="The last year of the cycle for this election.")
address_city = db.Column(db.String(100))
address_state = db.Column(db.String(2))
address_street_1 = db.Column(db.String(200))
address_street_2 = db.Column(db.String(200))
address_zip = db.Column(db.String(10))
candidate_inactive = db.Column(db.Boolean)


class CandidateTotal(db.Model):
__tablename__ = 'ofec_candidate_totals_with_0s_mv'
candidate_id = db.Column(db.String, index=True, primary_key=True)
Expand Down
6 changes: 0 additions & 6 deletions webservices/flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ def get_graph():
'candidate_flags',
'candidate_fulltext',
'candidate_history',
'candidate_history_latest',
'committee_detail',
'committee_fulltext',
'committee_history',
Expand Down Expand Up @@ -54,11 +53,6 @@ def get_graph():
graph.add_edge('candidate_history', 'candidate_detail')
graph.add_edge('candidate_detail', 'candidate_election')

graph.add_edges_from([
('candidate_history', 'candidate_history_latest'),
('candidate_election', 'candidate_history_latest')
])

graph.add_edge('committee_history', 'committee_detail')

graph.add_edges_from([
Expand Down

0 comments on commit faa1e69

Please sign in to comment.