Skip to content

Commit

Permalink
delete previous election edge if it exists
Browse files Browse the repository at this point in the history
  • Loading branch information
n13 committed Oct 23, 2023
1 parent 4f65d05 commit 141d589
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/upvote_election/actions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -842,6 +842,11 @@ namespace hypha {
// delete ongoing election link
Edge::get(get_self(), daoId, election.getId(), upvote_common::links::ONGOING_ELECTION).erase();

// delete previous previous election link
if (auto [exists, edge] = Edge::getIfExists(get_self(), daoId, upvote_common::links::PREVIOUS_ELECTION); exists) {
edge.erase();
}

// add previous election link
Edge(get_self(), get_self(), daoId, election.getId(), upvote_common::links::PREVIOUS_ELECTION);

Expand Down

0 comments on commit 141d589

Please sign in to comment.