Skip to content

Commit

Permalink
Fix for HAL-06 issue.
Browse files Browse the repository at this point in the history
Removed match statement from simple voter.
  • Loading branch information
kubaplas committed May 6, 2024
1 parent 8100ab3 commit 7eb4c46
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 17 deletions.
5 changes: 1 addition & 4 deletions dao/src/voting/voting_engine/voting_state_machine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,7 @@ impl VotingStateMachine {
let voting_time = configuration.informal_voting_time();
start_time + voting_time <= block_time
}
VotingType::Formal => {
self.formal_voting_end_time(configuration)
<= block_time
}
VotingType::Formal => self.formal_voting_end_time(configuration) <= block_time,
}
}

Expand Down
20 changes: 7 additions & 13 deletions dao/src/voting_contracts/simple_voter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,19 +100,13 @@ impl SimpleVoterContract {
pub fn finish_voting(&mut self, voting_id: VotingId, voting_type: VotingType) -> VotingSummary {
let voting_summary = self.voting_engine.finish_voting(voting_id, voting_type);

if let VotingType::Informal = voting_summary.voting_type() {
match voting_summary.voting_type() {
VotingType::Informal => {}
// Informal voting ended in favor, creating a new formal voting
VotingType::Formal => {
self.simple_votings.set(
&voting_id,
self.simple_votings
.get(&voting_id)
.unwrap_or_revert_with(Error::VariableValueNotSet),
);
}
}
if let VotingType::Formal = voting_summary.voting_type() {
self.simple_votings.set(
&voting_id,
self.simple_votings
.get(&voting_id)
.unwrap_or_revert_with(Error::VariableValueNotSet),
);
}
voting_summary
}
Expand Down

0 comments on commit 7eb4c46

Please sign in to comment.