2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-05 00:46:08 +00:00

Always display nice percent values.

Sum of percent values should never exceed 100%. If any two answers
received same amount of votes, they should show same percent values.
This way sum could be less than 100% (three answers, one vote each),
but this looks better than giving extra vote to some random answer.
This commit is contained in:
John Preston
2018-12-25 18:17:02 +04:00
parent 6fc4facddf
commit 8708a001c7
6 changed files with 152 additions and 60 deletions

View File

@@ -1523,7 +1523,7 @@ not_null<PollData*> Session::poll(const MTPDmessageMediaPoll &data) {
const auto result = poll(data.vpoll);
const auto changed = result->applyResults(data.vresults);
if (changed) {
requestPollViewRepaint(result);
notifyPollUpdateDelayed(result);
}
return result;
}
@@ -1538,7 +1538,7 @@ void Session::applyPollUpdate(const MTPDupdateMessagePoll &update) {
: i->second.get();
}();
if (updated && updated->applyResults(update.vresults)) {
requestPollViewRepaint(updated);
notifyPollUpdateDelayed(updated);
}
}