Skip to content

Commit 1adff1f

Browse files
authored
Merge pull request #121 from voteagora/fix/normalizeProposalTypeId
Fix: Normalise proposal_type to proposal_type_id for all tenants
2 parents 1c51939 + 9267c36 commit 1adff1f

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

app/data_products.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -699,7 +699,7 @@ def set_voting_module_name(self, name):
699699

700700
def set_proposal_type(self, proposal_type):
701701
self.proposal_type = proposal_type
702-
self.create_event['proposal_type'] = proposal_type
702+
self.create_event['proposal_type_id'] = proposal_type
703703

704704
def reverse_engineer_module_name(self, signature, proposal_data):
705705
voting_module_name = reverse_engineer_module(signature, proposal_data)
@@ -835,6 +835,10 @@ def handle(self, event):
835835

836836
try:
837837
if 'ProposalCreated' == signature[:LCREATED]:
838+
if 'proposal_type' in event:
839+
event['proposal_type_id'] = event['proposal_type']
840+
del event['proposal_type']
841+
838842
if signature == PROPOSAL_CREATED_MODULE:
839843
if proposal_id in self.proposals:
840844
proposal = self.proposals[proposal_id]

tests/test_data_products.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ def test_Proposals_one_op_approval_from_csv(op_governor_abis):
264264

265265
del first_proposal.create_event['description']
266266

267-
assert first_proposal.create_event['proposal_type'] == 3
267+
assert first_proposal.create_event['proposal_type_id'] == 3
268268
assert first_proposal.create_event['voting_module_name'] == 'approval'
269269

270270
assert first_proposal.create_event['decoded_proposal_data'] == (((0, (), (), (), 'World Foundation'), (0, (), (), (), 'Andrey Petrov'), (0, (), (), (), 'OP Labs'), (0, (), (), (), 'L2BEAT'), (0, (), (), (), 'Alchemy'), (0, (), (), (), 'Maggie Love'), (0, (), (), (), 'Gauntlet'), (0, (), (), (), 'Test in Prod'), (0, (), (), (), 'Yoav Weiss'), (0, (), (), (), 'ml_sudo'), (0, (), (), (), 'Kris Kaczor'), (0, (), (), (), 'Martin Tellechea'), (0, (), (), (), 'Ink'), (0, (), (), (), 'Coinbase'), (0, (), (), (), 'troy')), (15, 1, '0x0000000000000000000000000000000000000000', 6, 0))
@@ -535,7 +535,7 @@ def test_Proposals_agora_v2_proposal_creation(v2_proposal_abi):
535535
# Verify proposal type is extracted from description
536536
assert '15955855790422721941705776916809127869130159600460608057182735456172624954953' in proposals.proposals
537537
assert proposals.proposals['15955855790422721941705776916809127869130159600460608057182735456172624954953'].proposal_type == 9
538-
assert proposals.proposals['15955855790422721941705776916809127869130159600460608057182735456172624954953'].create_event['proposal_type'] == 9
538+
assert proposals.proposals['15955855790422721941705776916809127869130159600460608057182735456172624954953'].create_event['proposal_type_id'] == 9
539539

540540
proposal = proposals.proposals['15955855790422721941705776916809127869130159600460608057182735456172624954953']
541541
assert proposal.voting_module_name == 'standard'

0 commit comments

Comments
 (0)