Cleanup ballot domain

This commit is contained in:
Manfred Karrer 2018-08-09 00:39:12 +02:00
parent 4fddc5d089
commit 185eee2fcb
No known key found for this signature in database
GPG Key ID: 401250966A6B2C46
3 changed files with 8 additions and 8 deletions

View File

@ -185,7 +185,7 @@ public class ProposalsView extends ActivatableView<GridPane, Void> implements Bs
sortedList.comparatorProperty().bind(tableView.comparatorProperty());
daoFacade.getActiveOrMyUnconfirmedProposals().addListener(proposalListChangeListener);
daoFacade.getValidAndConfirmedBallots().addListener(ballotListChangeListener);
daoFacade.getBallots().addListener(ballotListChangeListener);
daoFacade.addBsqStateListener(this);
bsqWalletService.addBsqBalanceListener(this);
@ -213,7 +213,7 @@ public class ProposalsView extends ActivatableView<GridPane, Void> implements Bs
sortedList.comparatorProperty().unbind();
daoFacade.getActiveOrMyUnconfirmedProposals().removeListener(proposalListChangeListener);
daoFacade.getValidAndConfirmedBallots().removeListener(ballotListChangeListener);
daoFacade.getBallots().removeListener(ballotListChangeListener);
daoFacade.removeBsqStateListener(this);
bsqWalletService.removeBsqBalanceListener(this);
@ -284,7 +284,7 @@ public class ProposalsView extends ActivatableView<GridPane, Void> implements Bs
.collect(Collectors.toSet()));
} else {
// blind vote phase
List<Ballot> ballotList = daoFacade.getValidAndConfirmedBallots();
List<Ballot> ballotList = daoFacade.getBallots();
listItems.setAll(ballotList.stream()
.map(ballot -> new ProposalsListItem(ballot, daoFacade, bsqFormatter))
.collect(Collectors.toSet()));

View File

@ -70,7 +70,7 @@ public class VoteListItem {
public Tuple2<AwesomeIcon, String> getIconStyleTuple() {
Optional<Boolean> isAccepted;
isAccepted = decryptedVote.getBallotList().stream()
.filter(ballot -> ballot.getProposalTxId().equals(proposalTxId))
.filter(ballot -> ballot.getTxId().equals(proposalTxId))
.map(Ballot::getVote)
.filter(vote -> vote instanceof BooleanVote)
.map(vote -> (BooleanVote) vote)

View File

@ -225,8 +225,8 @@ public class VoteResultView extends ActivatableView<GridPane, Void> implements B
if (selectedProposalListItem != null) {
EvaluatedProposal evaluatedProposal = selectedProposalListItem.getEvaluatedProposal();
Optional<Ballot> optionalBallot = daoFacade.getAllBallots().stream()
.filter(ballot -> ballot.getProposalTxId().equals(evaluatedProposal.getProposalTxId()))
Optional<Ballot> optionalBallot = daoFacade.getBallots().stream()
.filter(ballot -> ballot.getTxId().equals(evaluatedProposal.getProposalTxId()))
.findAny();
Ballot ballot = optionalBallot.orElse(null);
createProposalDisplay(evaluatedProposal, ballot);
@ -330,9 +330,9 @@ public class VoteResultView extends ActivatableView<GridPane, Void> implements B
proposalList.clear();
proposalList.forEach(ProposalListItem::resetTableRow);
Map<String, Ballot> ballotByProposalTxIdMap = daoFacade.getAllBallots()
Map<String, Ballot> ballotByProposalTxIdMap = daoFacade.getBallots()
.stream()
.collect(Collectors.toMap(Ballot::getProposalTxId, ballot -> ballot));
.collect(Collectors.toMap(Ballot::getTxId, ballot -> ballot));
proposalList.setAll(resultsOfCycle.getEvaluatedProposals().stream()
.map(evaluatedProposal -> new ProposalListItem(evaluatedProposal,
ballotByProposalTxIdMap.get(evaluatedProposal.getProposalTxId()),