Skip to content

Commit

Permalink
feat/#46 add unit test for position follow (#49)
Browse files Browse the repository at this point in the history
Co-authored-by: Quoc Le <[email protected]>
  • Loading branch information
danielvo11 and quocle108 committed Dec 8, 2020
1 parent 9a73523 commit dcbfa57
Show file tree
Hide file tree
Showing 6 changed files with 341 additions and 37 deletions.
Binary file modified community/community.wasm
Binary file not shown.
4 changes: 3 additions & 1 deletion community/include/community.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,9 @@ CONTRACT community : public contract
((v1.position)(v1_position)(v1_position_table))
((v1.codeexec)(v1_sole_decision)(v1_code_sole_decision_table))
((v1.amenexec)(v1_sole_decision)(v1_amend_sole_decision_table))
((v1.cproposal)(v1_code_proposal)(v1_code_proposals_table))
((v1.filling)(v1_election_rule)(v1_election_table))
((v1.pproposal)(v1_pos_proposal)(v1_posproposal_table))
((v1.candidate)(v1_pos_candidate)(v1_poscandidate_table))
)
#endif
};
5 changes: 2 additions & 3 deletions community/src/community.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1264,7 +1264,6 @@ ACTION community::createpos(
vector<name> code_actions;
code_actions.push_back("configpos"_n);

// TO DO: create configpos with creator (exec_type = SOLE_DESICION) for code_execution_right amendment_execution_right
auto configCode = _codes.emplace(ram_payer, [&](auto &row) {
row.code_id = _codes.available_primary_key();
row.code_name = PO_Config;
Expand Down Expand Up @@ -1666,9 +1665,9 @@ ACTION community::voteforpos(name community_account, uint64_t pos_id, name voter
check(candidate_itr != _pos_candidate.end(), "ERR::CANDIDATE_NOT_ESIXT::The candidate does not exist");

auto new_voters_detail = candidate_itr->voters;
auto voter_detail_itr = std::find(candidate_itr->voters.begin(), candidate_itr->voters.end(), voter);
auto voter_detail_itr = std::find(new_voters_detail.begin(), new_voters_detail.end(), voter);

if (voter_detail_itr == candidate_itr->voters.end())
if (voter_detail_itr == new_voters_detail.end())
{
if (vote_status == VoteStatus::VOTE) {
new_voters_detail.push_back(voter);
Expand Down
33 changes: 0 additions & 33 deletions test/community/community.abi
Original file line number Diff line number Diff line change
Expand Up @@ -403,34 +403,6 @@
}
]
},
{
"name": "hydraload",
"base": "",
"fields": [
{
"name": "payload",
"type": "hydraload_payload[]"
}
]
},
{
"name": "hydraload_payload",
"base": "",
"fields": [
{
"name": "table_name",
"type": "name"
},
{
"name": "scope",
"type": "name"
},
{
"name": "row_data",
"type": "bytes"
}
]
},
{
"name": "initadminpos",
"base": "",
Expand Down Expand Up @@ -1277,11 +1249,6 @@
"type": "execproposal",
"ricardian_contract": ""
},
{
"name": "hydraload",
"type": "hydraload",
"ricardian_contract": ""
},
{
"name": "initadminpos",
"type": "initadminpos",
Expand Down
Binary file modified test/community/community.wasm
Binary file not shown.
Loading

0 comments on commit dcbfa57

Please sign in to comment.