Skip to content
This repository has been archived by the owner on Jun 17, 2020. It is now read-only.

Commit

Permalink
Add combined proposal vote view
Browse files Browse the repository at this point in the history
  • Loading branch information
ManfredKarrer committed Jul 26, 2018
1 parent 2c88005 commit f6f6261
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/main/java/bisq/core/dao/DaoFacade.java
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,10 @@ public List<MyVote> getMyVoteList() {
return myVoteListService.getMyVoteList().getList();
}

public List<MyVote> getMyVoteListForCycle() {
return myVoteListService.getMyVoteListForCycle();
}


///////////////////////////////////////////////////////////////////////////////////////////
// Use case: Vote
Expand Down
7 changes: 5 additions & 2 deletions src/main/java/bisq/core/dao/state/period/Cycle.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,11 @@ public int getHeightOfLastBlock() {
}

public boolean isInPhase(int height, DaoPhase.Phase phase) {
return height >= getFirstBlockOfPhase(phase) &&
height <= getLastBlockOfPhase(phase);
return height >= getFirstBlockOfPhase(phase) && height <= getLastBlockOfPhase(phase);
}

public boolean isInCycle(int height) {
return height >= getHeightOfFirstBlock() && height <= getHeightOfLastBlock();
}

public int getFirstBlockOfPhase(DaoPhase.Phase phase) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@

import javax.crypto.SecretKey;

import java.util.List;
import java.util.stream.Collectors;

import lombok.extern.slf4j.Slf4j;

/**
Expand Down Expand Up @@ -95,6 +98,12 @@ public MyVoteList getMyVoteList() {
return myVoteList;
}

public List<MyVote> getMyVoteListForCycle() {
return myVoteList.getList().stream()
.filter(e -> bsqStateService.getCurrentCycle().isInCycle(e.getHeight()))
.collect(Collectors.toList());
}


///////////////////////////////////////////////////////////////////////////////////////////
// Private
Expand Down
3 changes: 2 additions & 1 deletion src/main/resources/i18n/displayStrings.properties
Original file line number Diff line number Diff line change
Expand Up @@ -1261,7 +1261,8 @@ dao.proposal.myVotes.tx=Vote transaction ID
dao.proposal.myVotes.tooltip.showProposalList=Show proposal list used in that vote
dao.proposal.myVotes.proposals.header=Proposals
dao.proposal.myVotes.myVote=Vote
dao.proposal.votes.header=Votes
dao.proposal.votes.header=Vote on all proposals
dao.proposal.votes.header.voted=My vote
dao.proposal.votes.stake=Stake
dao.proposal.myVote.button=Vote on all proposals
dao.proposal.active.successfullyFunded=Compensation request successfully funded.
Expand Down

0 comments on commit f6f6261

Please sign in to comment.