Skip to content

Commit

Permalink
Check for result phase at activate method
Browse files Browse the repository at this point in the history
  • Loading branch information
chimp1984 committed Oct 28, 2019
1 parent b9dbf8f commit 09e68fa
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ protected void activate() {
cyclesTableView.getSelectionModel().selectedItemProperty().addListener(selectedVoteResultListItemListener);

if (daoStateService.isParseBlockChainComplete()) {
checkForResultPhase(daoStateService.getChainHeight());
fillCycleList();
}

Expand Down Expand Up @@ -238,7 +239,11 @@ protected void deactivate() {

@Override
public void onParseBlockCompleteAfterBatchProcessing(Block block) {
int chainHeight = daoStateService.getChainHeight();
checkForResultPhase(daoStateService.getChainHeight());
fillCycleList();
}

private void checkForResultPhase(int chainHeight) {
if (periodService.getFirstBlockOfPhase(chainHeight, DaoPhase.Phase.RESULT) == chainHeight) {
// We had set the cycle initially but at the vote result we want to update it with the actual result.
// We remove the empty cycle to make space for the one with the result.
Expand All @@ -251,8 +256,6 @@ public void onParseBlockCompleteAfterBatchProcessing(Block block) {
.findAny();
optionalCurrentCycleListItem.ifPresent(cycleListItemList::remove);
}

fillCycleList();
}


Expand Down

0 comments on commit 09e68fa

Please sign in to comment.