Fix #544
This commit is contained in:
parent
c3aa3af650
commit
fc67c82040
|
@ -16,6 +16,7 @@ public class Poll extends BaseModel{
|
|||
private boolean expired;
|
||||
public boolean multiple;
|
||||
public int votersCount;
|
||||
public int votesCount;
|
||||
public boolean voted;
|
||||
@RequiredField
|
||||
public List<Integer> ownVotes;
|
||||
|
@ -41,10 +42,12 @@ public class Poll extends BaseModel{
|
|||
", expired="+expired+
|
||||
", multiple="+multiple+
|
||||
", votersCount="+votersCount+
|
||||
", votesCount="+votesCount+
|
||||
", voted="+voted+
|
||||
", ownVotes="+ownVotes+
|
||||
", options="+options+
|
||||
", emojis="+emojis+
|
||||
", selectedOptions="+selectedOptions+
|
||||
'}';
|
||||
}
|
||||
|
||||
|
|
|
@ -34,8 +34,9 @@ public class PollOptionStatusDisplayItem extends StatusDisplayItem{
|
|||
text=HtmlParser.parseCustomEmoji(option.title, poll.emojis);
|
||||
emojiHelper.setText(text);
|
||||
showResults=poll.isExpired() || poll.voted;
|
||||
if(showResults && option.votesCount!=null && poll.votersCount>0){
|
||||
votesFraction=(float)option.votesCount/(float)poll.votersCount;
|
||||
int total=poll.votersCount>0 ? poll.votersCount : poll.votesCount;
|
||||
if(showResults && option.votesCount!=null && total>0){
|
||||
votesFraction=(float)option.votesCount/(float)total;
|
||||
int mostVotedCount=0;
|
||||
for(Poll.Option opt:poll.options)
|
||||
mostVotedCount=Math.max(mostVotedCount, opt.votesCount);
|
||||
|
|
Loading…
Reference in New Issue