Add PollAnswer.is_being_chosen.
GitOrigin-RevId: 4465a640e3c4e687cb25f2dbf5705d00fe93d4c3
This commit is contained in:
parent
2e520364ad
commit
2f61afab89
@ -192,8 +192,9 @@ maskPointChin = MaskPoint;
|
||||
maskPosition point:MaskPoint x_shift:double y_shift:double scale:double = MaskPosition;
|
||||
|
||||
|
||||
//@description Describes one answer option of a poll @text Option text, 1-100 characters @voter_count Number of voters for this option, available only for closed or voted polls @vote_percentage The percentage of votes for this option, 0-100 @is_chosen True, if the option was chosen by the user
|
||||
pollOption text:string voter_count:int32 vote_percentage:int32 is_chosen:Bool = PollOption;
|
||||
//@description Describes one answer option of a poll @text Option text, 1-100 characters @voter_count Number of voters for this option, available only for closed or voted polls @vote_percentage The percentage of votes for this option, 0-100
|
||||
//@is_chosen True, if the option was chosen by the user @is_being_chosen True, if the option is being chosen by a pending setPollAnswer request
|
||||
pollOption text:string voter_count:int32 vote_percentage:int32 is_chosen:Bool is_being_chosen:Bool = PollOption;
|
||||
|
||||
|
||||
//@description Describes an animation file. The animation must be encoded in GIF or MPEG4 format @duration Duration of the animation, in seconds; as defined by the sender @width Width of the animation @height Height of the animation
|
||||
|
Binary file not shown.
@ -309,7 +309,8 @@ PollManager::Poll *PollManager::get_poll_force(PollId poll_id) {
|
||||
}
|
||||
|
||||
td_api::object_ptr<td_api::pollOption> PollManager::get_poll_option_object(const PollOption &poll_option) {
|
||||
return td_api::make_object<td_api::pollOption>(poll_option.text, poll_option.voter_count, 0, poll_option.is_chosen);
|
||||
return td_api::make_object<td_api::pollOption>(poll_option.text, poll_option.voter_count, 0, poll_option.is_chosen,
|
||||
false);
|
||||
}
|
||||
|
||||
vector<int32> PollManager::get_vote_percentage(const vector<int32> &voter_counts, int32 total_voter_count) {
|
||||
@ -420,18 +421,14 @@ td_api::object_ptr<td_api::poll> PollManager::get_poll_object(PollId poll_id) co
|
||||
} else {
|
||||
auto &chosen_options = it->second.options_;
|
||||
for (auto &poll_option : poll->options) {
|
||||
auto is_chosen =
|
||||
auto is_being_chosen =
|
||||
std::find(chosen_options.begin(), chosen_options.end(), poll_option.data) != chosen_options.end();
|
||||
if (poll_option.is_chosen) {
|
||||
voter_count_diff = -1;
|
||||
}
|
||||
poll_options.push_back(td_api::make_object<td_api::pollOption>(
|
||||
poll_option.text,
|
||||
poll_option.voter_count - static_cast<int32>(poll_option.is_chosen) + static_cast<int32>(is_chosen), 0,
|
||||
is_chosen));
|
||||
}
|
||||
if (!chosen_options.empty()) {
|
||||
voter_count_diff++;
|
||||
poll_option.text, poll_option.voter_count - static_cast<int32>(poll_option.is_chosen), 0, false,
|
||||
is_being_chosen));
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user